X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Ftar;a=blobdiff_plain;f=src%2Fsystem.c;h=94142336ef6d021868836cf94a97720ee9d20429;hp=6adcbf02a099460f4959cee625809ceba13f7716;hb=45ccda119355a1087450039a250359c1d0de0d08;hpb=7b5e803963822e69a73d00ba62ac01b1c23f112c diff --git a/src/system.c b/src/system.c index 6adcbf0..9414233 100644 --- a/src/system.c +++ b/src/system.c @@ -1,6 +1,6 @@ /* System-dependent calls for tar. - Copyright 2003-2008, 2010, 2013 Free Software Foundation, Inc. + Copyright 2003-2008, 2010, 2013-2014 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -23,7 +23,7 @@ #include #include -static void +static _Noreturn void xexec (const char *cmd) { struct wordsplit ws; @@ -329,7 +329,7 @@ sys_child_open_for_compress (void) int child_pipe[2]; pid_t grandchild_pid; pid_t child_pid; - + xpipe (parent_pipe); child_pid = xfork (); @@ -474,7 +474,7 @@ run_decompress_program (void) ws.ws_env = (const char **) environ; ws.ws_offs = 1; - + for (p = first_decompress_program (&i); p; p = next_decompress_program (&i)) { if (prog) @@ -490,8 +490,8 @@ run_decompress_program (void) wsflags |= WRDSF_REUSE; memmove(ws.ws_wordv, ws.ws_wordv + ws.ws_offs, sizeof(ws.ws_wordv[0])*ws.ws_wordc); - ws.ws_wordv[ws.ws_wordc] = "-d"; - prog = p; + ws.ws_wordv[ws.ws_wordc] = (char *) "-d"; + prog = p; execvp (ws.ws_wordv[0], ws.ws_wordv); ws.ws_wordv[ws.ws_wordc] = NULL; } @@ -720,14 +720,13 @@ stat_to_env (char *name, char type, struct tar_stat_info *st) } static pid_t global_pid; -static RETSIGTYPE (*pipe_handler) (int sig); +static void (*pipe_handler) (int sig); int sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st) { int p[2]; - char *argv[4]; - + xpipe (p); pipe_handler = signal (SIGPIPE, SIG_IGN); global_pid = xfork (); @@ -787,10 +786,9 @@ int sys_exec_info_script (const char **archive_name, int volume_number) { pid_t pid; - char *argv[4]; char uintbuf[UINTMAX_STRSIZE_BOUND]; int p[2]; - static RETSIGTYPE (*saved_handler) (int sig); + static void (*saved_handler) (int sig); xpipe (p); saved_handler = signal (SIGPIPE, SIG_IGN); @@ -849,7 +847,7 @@ sys_exec_info_script (const char **archive_name, int volume_number) archive_format_string (current_format == DEFAULT_FORMAT ? archive_format : current_format), 1); setenv ("TAR_FD", STRINGIFY_BIGINT (p[PWRITE], uintbuf), 1); - + xclose (p[PREAD]); priv_set_restore_linkdir (); @@ -862,9 +860,8 @@ sys_exec_checkpoint_script (const char *script_name, int checkpoint_number) { pid_t pid; - char *argv[4]; char uintbuf[UINTMAX_STRSIZE_BOUND]; - + pid = xfork (); if (pid != 0) @@ -893,11 +890,6 @@ sys_exec_checkpoint_script (const char *script_name, setenv ("TAR_FORMAT", archive_format_string (current_format == DEFAULT_FORMAT ? 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 (); xexec (script_name); }