tar: remove lint

* lib/wordsplit.c (_wsplit_error): Mark with printf attribute.
(expvar): "Use" defstr to pacify GCC.
* src/system.c (xexec): Now _Noreturn, to pacify GCC.
(run_decompress_program): Add cast to pacify GCC.
(sys_exec_command, sys_exec_info_script, sys_exec_checkpoint_script):
Remove unused variables.
This commit is contained in:
Paul Eggert
2013-02-20 08:09:38 -08:00
parent 7b5e803963
commit 17f99bc6f1
2 changed files with 13 additions and 18 deletions

View File

@@ -61,7 +61,7 @@ _wsplt_alloc_die (struct wordsplit *wsp)
abort (); abort ();
} }
static void static void __attribute__ ((__format__ (__printf__, 1, 2)))
_wsplt_error (const char *fmt, ...) _wsplt_error (const char *fmt, ...)
{ {
va_list ap; va_list ap;
@@ -795,7 +795,10 @@ expvar (struct wordsplit *wsp, const char *str, size_t len,
else else
value = ""; value = "";
} }
/* FIXME: handle defstr */ /* FIXME: handle defstr */
(void) defstr;
if (value) if (value)
{ {
if (flg & _WSNF_QUOTE) if (flg & _WSNF_QUOTE)

View File

@@ -23,7 +23,7 @@
#include <signal.h> #include <signal.h>
#include <wordsplit.h> #include <wordsplit.h>
static void static _Noreturn void
xexec (const char *cmd) xexec (const char *cmd)
{ {
struct wordsplit ws; struct wordsplit ws;
@@ -490,7 +490,7 @@ run_decompress_program (void)
wsflags |= WRDSF_REUSE; wsflags |= WRDSF_REUSE;
memmove(ws.ws_wordv, ws.ws_wordv + ws.ws_offs, memmove(ws.ws_wordv, ws.ws_wordv + ws.ws_offs,
sizeof(ws.ws_wordv[0])*ws.ws_wordc); sizeof(ws.ws_wordv[0])*ws.ws_wordc);
ws.ws_wordv[ws.ws_wordc] = "-d"; ws.ws_wordv[ws.ws_wordc] = (char *) "-d";
prog = p; prog = p;
execvp (ws.ws_wordv[0], ws.ws_wordv); execvp (ws.ws_wordv[0], ws.ws_wordv);
ws.ws_wordv[ws.ws_wordc] = NULL; ws.ws_wordv[ws.ws_wordc] = NULL;
@@ -726,7 +726,6 @@ int
sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st) sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st)
{ {
int p[2]; int p[2];
char *argv[4];
xpipe (p); xpipe (p);
pipe_handler = signal (SIGPIPE, SIG_IGN); pipe_handler = signal (SIGPIPE, SIG_IGN);
@@ -787,7 +786,6 @@ int
sys_exec_info_script (const char **archive_name, int volume_number) sys_exec_info_script (const char **archive_name, int volume_number)
{ {
pid_t pid; pid_t pid;
char *argv[4];
char uintbuf[UINTMAX_STRSIZE_BOUND]; char uintbuf[UINTMAX_STRSIZE_BOUND];
int p[2]; int p[2];
static RETSIGTYPE (*saved_handler) (int sig); static RETSIGTYPE (*saved_handler) (int sig);
@@ -862,7 +860,6 @@ sys_exec_checkpoint_script (const char *script_name,
int checkpoint_number) int checkpoint_number)
{ {
pid_t pid; pid_t pid;
char *argv[4];
char uintbuf[UINTMAX_STRSIZE_BOUND]; char uintbuf[UINTMAX_STRSIZE_BOUND];
pid = xfork (); pid = xfork ();
@@ -893,11 +890,6 @@ sys_exec_checkpoint_script (const char *script_name,
setenv ("TAR_FORMAT", setenv ("TAR_FORMAT",
archive_format_string (current_format == DEFAULT_FORMAT ? archive_format_string (current_format == DEFAULT_FORMAT ?
archive_format : current_format), 1); archive_format : current_format), 1);
argv[0] = (char *) "/bin/sh";
argv[1] = (char *) "-c";
argv[2] = (char *) script_name;
argv[3] = NULL;
priv_set_restore_linkdir (); priv_set_restore_linkdir ();
xexec (script_name); xexec (script_name);
} }