]> Dogcows Code - chaz/tar/blob - src/system.c
Minor changes.
[chaz/tar] / src / system.c
1 /* System-dependent calls for tar.
2
3 Copyright (C) 2003, 2004, 2005, 2006, 2007,
4 2008 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any later
9 version.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14 Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19
20 #include <system.h>
21
22 #include "common.h"
23 #include <rmt.h>
24 #include <signal.h>
25
26 #if MSDOS
27
28 bool
29 sys_get_archive_stat (void)
30 {
31 return 0;
32 }
33
34 bool
35 sys_file_is_archive (struct tar_stat_info *p)
36 {
37 return false;
38 }
39
40 void
41 sys_save_archive_dev_ino (void)
42 {
43 }
44
45 void
46 sys_detect_dev_null_output (void)
47 {
48 static char const dev_null[] = "nul";
49
50 dev_null_output = (strcmp (archive_name_array[0], dev_null) == 0
51 || (! _isrmt (archive)));
52 }
53
54 void
55 sys_wait_for_child (pid_t child_pid, bool eof)
56 {
57 }
58
59 void
60 sys_spawn_shell (void)
61 {
62 spawnl (P_WAIT, getenv ("COMSPEC"), "-", 0);
63 }
64
65 /* stat() in djgpp's C library gives a constant number of 42 as the
66 uid and gid of a file. So, comparing an FTP'ed archive just after
67 unpack would fail on MSDOS. */
68
69 bool
70 sys_compare_uid (struct stat *a, struct stat *b)
71 {
72 return true;
73 }
74
75 bool
76 sys_compare_gid (struct stat *a, struct stat *b)
77 {
78 return true;
79 }
80
81 void
82 sys_compare_links (struct stat *link_data, struct stat *stat_data)
83 {
84 return true;
85 }
86
87 int
88 sys_truncate (int fd)
89 {
90 return write (fd, "", 0);
91 }
92
93 size_t
94 sys_write_archive_buffer (void)
95 {
96 return full_write (archive, record_start->buffer, record_size);
97 }
98
99 /* Set ARCHIVE for writing, then compressing an archive. */
100 void
101 sys_child_open_for_compress (void)
102 {
103 FATAL_ERROR ((0, 0, _("Cannot use compressed or remote archives")));
104 }
105
106 /* Set ARCHIVE for uncompressing, then reading an archive. */
107 void
108 sys_child_open_for_uncompress (void)
109 {
110 FATAL_ERROR ((0, 0, _("Cannot use compressed or remote archives")));
111 }
112
113 #else
114
115 extern union block *record_start; /* FIXME */
116
117 static struct stat archive_stat; /* stat block for archive file */
118
119 bool
120 sys_get_archive_stat (void)
121 {
122 return fstat (archive, &archive_stat) == 0;
123 }
124
125 bool
126 sys_file_is_archive (struct tar_stat_info *p)
127 {
128 return (ar_dev && p->stat.st_dev == ar_dev && p->stat.st_ino == ar_ino);
129 }
130
131 /* Save archive file inode and device numbers */
132 void
133 sys_save_archive_dev_ino (void)
134 {
135 if (!_isrmt (archive) && S_ISREG (archive_stat.st_mode))
136 {
137 ar_dev = archive_stat.st_dev;
138 ar_ino = archive_stat.st_ino;
139 }
140 else
141 ar_dev = 0;
142 }
143
144 /* Detect if outputting to "/dev/null". */
145 void
146 sys_detect_dev_null_output (void)
147 {
148 static char const dev_null[] = "/dev/null";
149 struct stat dev_null_stat;
150
151 dev_null_output = (strcmp (archive_name_array[0], dev_null) == 0
152 || (! _isrmt (archive)
153 && S_ISCHR (archive_stat.st_mode)
154 && stat (dev_null, &dev_null_stat) == 0
155 && archive_stat.st_dev == dev_null_stat.st_dev
156 && archive_stat.st_ino == dev_null_stat.st_ino));
157 }
158
159 void
160 sys_wait_for_child (pid_t child_pid, bool eof)
161 {
162 if (child_pid)
163 {
164 int wait_status;
165
166 while (waitpid (child_pid, &wait_status, 0) == -1)
167 if (errno != EINTR)
168 {
169 waitpid_error (use_compress_program_option);
170 break;
171 }
172
173 if (WIFSIGNALED (wait_status))
174 {
175 int sig = WTERMSIG (wait_status);
176 if (!(!eof && sig == SIGPIPE))
177 FATAL_ERROR ((0, 0, _("Child died with signal %d"), sig));
178 }
179 else if (WEXITSTATUS (wait_status) != 0)
180 FATAL_ERROR ((0, 0, _("Child returned status %d"),
181 WEXITSTATUS (wait_status)));
182 }
183 }
184
185 void
186 sys_spawn_shell (void)
187 {
188 pid_t child;
189 const char *shell = getenv ("SHELL");
190 if (! shell)
191 shell = "/bin/sh";
192 child = xfork ();
193 if (child == 0)
194 {
195 execlp (shell, "-sh", "-i", (char *) 0);
196 exec_fatal (shell);
197 }
198 else
199 {
200 int wait_status;
201 while (waitpid (child, &wait_status, 0) == -1)
202 if (errno != EINTR)
203 {
204 waitpid_error (shell);
205 break;
206 }
207 }
208 }
209
210 bool
211 sys_compare_uid (struct stat *a, struct stat *b)
212 {
213 return a->st_uid == b->st_uid;
214 }
215
216 bool
217 sys_compare_gid (struct stat *a, struct stat *b)
218 {
219 return a->st_gid == b->st_gid;
220 }
221
222 bool
223 sys_compare_links (struct stat *link_data, struct stat *stat_data)
224 {
225 return stat_data->st_dev == link_data->st_dev
226 && stat_data->st_ino == link_data->st_ino;
227 }
228
229 int
230 sys_truncate (int fd)
231 {
232 off_t pos = lseek (fd, (off_t) 0, SEEK_CUR);
233 return pos < 0 ? -1 : ftruncate (fd, pos);
234 }
235
236 /* Return nonzero if NAME is the name of a regular file, or if the file
237 does not exist (so it would be created as a regular file). */
238 static int
239 is_regular_file (const char *name)
240 {
241 struct stat stbuf;
242
243 if (stat (name, &stbuf) == 0)
244 return S_ISREG (stbuf.st_mode);
245 else
246 return errno == ENOENT;
247 }
248
249 size_t
250 sys_write_archive_buffer (void)
251 {
252 return rmtwrite (archive, record_start->buffer, record_size);
253 }
254
255 #define PREAD 0 /* read file descriptor from pipe() */
256 #define PWRITE 1 /* write file descriptor from pipe() */
257
258 /* Duplicate file descriptor FROM into becoming INTO.
259 INTO is closed first and has to be the next available slot. */
260 static void
261 xdup2 (int from, int into)
262 {
263 if (from != into)
264 {
265 int status = close (into);
266
267 if (status != 0 && errno != EBADF)
268 {
269 int e = errno;
270 FATAL_ERROR ((0, e, _("Cannot close")));
271 }
272 status = dup (from);
273 if (status != into)
274 {
275 if (status < 0)
276 {
277 int e = errno;
278 FATAL_ERROR ((0, e, _("Cannot dup")));
279 }
280 abort ();
281 }
282 xclose (from);
283 }
284 }
285
286 void wait_for_grandchild (pid_t pid) __attribute__ ((__noreturn__));
287
288 /* Propagate any failure of the grandchild back to the parent. */
289 void
290 wait_for_grandchild (pid_t pid)
291 {
292 int wait_status;
293 int exit_code = 0;
294
295 while (waitpid (pid, &wait_status, 0) == -1)
296 if (errno != EINTR)
297 {
298 waitpid_error (use_compress_program_option);
299 break;
300 }
301
302 if (WIFSIGNALED (wait_status))
303 raise (WTERMSIG (wait_status));
304 else if (WEXITSTATUS (wait_status) != 0)
305 exit_code = WEXITSTATUS (wait_status);
306
307 exit (exit_code);
308 }
309
310 /* Set ARCHIVE for writing, then compressing an archive. */
311 pid_t
312 sys_child_open_for_compress (void)
313 {
314 int parent_pipe[2];
315 int child_pipe[2];
316 pid_t grandchild_pid;
317 pid_t child_pid;
318
319 xpipe (parent_pipe);
320 child_pid = xfork ();
321
322 if (child_pid > 0)
323 {
324 /* The parent tar is still here! Just clean up. */
325
326 archive = parent_pipe[PWRITE];
327 xclose (parent_pipe[PREAD]);
328 return child_pid;
329 }
330
331 /* The new born child tar is here! */
332
333 set_program_name (_("tar (child)"));
334 signal (SIGPIPE, SIG_DFL);
335
336 xdup2 (parent_pipe[PREAD], STDIN_FILENO);
337 xclose (parent_pipe[PWRITE]);
338
339 /* Check if we need a grandchild tar. This happens only if either:
340 a) the file is to be accessed by rmt: compressor doesn't know how;
341 b) the file is not a plain file. */
342
343 if (!_remdev (archive_name_array[0])
344 && is_regular_file (archive_name_array[0]))
345 {
346 if (backup_option)
347 maybe_backup_file (archive_name_array[0], 1);
348
349 /* We don't need a grandchild tar. Open the archive and launch the
350 compressor. */
351 if (strcmp (archive_name_array[0], "-"))
352 {
353 archive = creat (archive_name_array[0], MODE_RW);
354 if (archive < 0)
355 {
356 int saved_errno = errno;
357
358 if (backup_option)
359 undo_last_backup ();
360 errno = saved_errno;
361 open_fatal (archive_name_array[0]);
362 }
363 xdup2 (archive, STDOUT_FILENO);
364 }
365 execlp (use_compress_program_option, use_compress_program_option, NULL);
366 exec_fatal (use_compress_program_option);
367 }
368
369 /* We do need a grandchild tar. */
370
371 xpipe (child_pipe);
372 grandchild_pid = xfork ();
373
374 if (grandchild_pid == 0)
375 {
376 /* The newborn grandchild tar is here! Launch the compressor. */
377
378 set_program_name (_("tar (grandchild)"));
379
380 xdup2 (child_pipe[PWRITE], STDOUT_FILENO);
381 xclose (child_pipe[PREAD]);
382 execlp (use_compress_program_option, use_compress_program_option,
383 (char *) 0);
384 exec_fatal (use_compress_program_option);
385 }
386
387 /* The child tar is still here! */
388
389 /* Prepare for reblocking the data from the compressor into the archive. */
390
391 xdup2 (child_pipe[PREAD], STDIN_FILENO);
392 xclose (child_pipe[PWRITE]);
393
394 if (strcmp (archive_name_array[0], "-") == 0)
395 archive = STDOUT_FILENO;
396 else
397 {
398 archive = rmtcreat (archive_name_array[0], MODE_RW, rsh_command_option);
399 if (archive < 0)
400 open_fatal (archive_name_array[0]);
401 }
402
403 /* Let's read out of the stdin pipe and write an archive. */
404
405 while (1)
406 {
407 size_t status = 0;
408 char *cursor;
409 size_t length;
410
411 /* Assemble a record. */
412
413 for (length = 0, cursor = record_start->buffer;
414 length < record_size;
415 length += status, cursor += status)
416 {
417 size_t size = record_size - length;
418
419 status = safe_read (STDIN_FILENO, cursor, size);
420 if (status == SAFE_READ_ERROR)
421 read_fatal (use_compress_program_option);
422 if (status == 0)
423 break;
424 }
425
426 /* Copy the record. */
427
428 if (status == 0)
429 {
430 /* We hit the end of the file. Write last record at
431 full length, as the only role of the grandchild is
432 doing proper reblocking. */
433
434 if (length > 0)
435 {
436 memset (record_start->buffer + length, 0, record_size - length);
437 status = sys_write_archive_buffer ();
438 if (status != record_size)
439 archive_write_error (status);
440 }
441
442 /* There is nothing else to read, break out. */
443 break;
444 }
445
446 status = sys_write_archive_buffer ();
447 if (status != record_size)
448 archive_write_error (status);
449 }
450
451 wait_for_grandchild (grandchild_pid);
452 }
453
454 /* Set ARCHIVE for uncompressing, then reading an archive. */
455 pid_t
456 sys_child_open_for_uncompress (void)
457 {
458 int parent_pipe[2];
459 int child_pipe[2];
460 pid_t grandchild_pid;
461 pid_t child_pid;
462
463 xpipe (parent_pipe);
464 child_pid = xfork ();
465
466 if (child_pid > 0)
467 {
468 /* The parent tar is still here! Just clean up. */
469
470 archive = parent_pipe[PREAD];
471 xclose (parent_pipe[PWRITE]);
472 return child_pid;
473 }
474
475 /* The newborn child tar is here! */
476
477 set_program_name (_("tar (child)"));
478 signal (SIGPIPE, SIG_DFL);
479
480 xdup2 (parent_pipe[PWRITE], STDOUT_FILENO);
481 xclose (parent_pipe[PREAD]);
482
483 /* Check if we need a grandchild tar. This happens only if either:
484 a) we're reading stdin: to force unblocking;
485 b) the file is to be accessed by rmt: compressor doesn't know how;
486 c) the file is not a plain file. */
487
488 if (strcmp (archive_name_array[0], "-") != 0
489 && !_remdev (archive_name_array[0])
490 && is_regular_file (archive_name_array[0]))
491 {
492 /* We don't need a grandchild tar. Open the archive and lauch the
493 uncompressor. */
494
495 archive = open (archive_name_array[0], O_RDONLY | O_BINARY, MODE_RW);
496 if (archive < 0)
497 open_fatal (archive_name_array[0]);
498 xdup2 (archive, STDIN_FILENO);
499 execlp (use_compress_program_option, use_compress_program_option,
500 "-d", (char *) 0);
501 exec_fatal (use_compress_program_option);
502 }
503
504 /* We do need a grandchild tar. */
505
506 xpipe (child_pipe);
507 grandchild_pid = xfork ();
508
509 if (grandchild_pid == 0)
510 {
511 /* The newborn grandchild tar is here! Launch the uncompressor. */
512
513 set_program_name (_("tar (grandchild)"));
514
515 xdup2 (child_pipe[PREAD], STDIN_FILENO);
516 xclose (child_pipe[PWRITE]);
517 execlp (use_compress_program_option, use_compress_program_option,
518 "-d", (char *) 0);
519 exec_fatal (use_compress_program_option);
520 }
521
522 /* The child tar is still here! */
523
524 /* Prepare for unblocking the data from the archive into the
525 uncompressor. */
526
527 xdup2 (child_pipe[PWRITE], STDOUT_FILENO);
528 xclose (child_pipe[PREAD]);
529
530 if (strcmp (archive_name_array[0], "-") == 0)
531 archive = STDIN_FILENO;
532 else
533 archive = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
534 MODE_RW, rsh_command_option);
535 if (archive < 0)
536 open_fatal (archive_name_array[0]);
537
538 /* Let's read the archive and pipe it into stdout. */
539
540 while (1)
541 {
542 char *cursor;
543 size_t maximum;
544 size_t count;
545 size_t status;
546
547 clear_read_error_count ();
548
549 error_loop:
550 status = rmtread (archive, record_start->buffer, record_size);
551 if (status == SAFE_READ_ERROR)
552 {
553 archive_read_error ();
554 goto error_loop;
555 }
556 if (status == 0)
557 break;
558 cursor = record_start->buffer;
559 maximum = status;
560 while (maximum)
561 {
562 count = maximum < BLOCKSIZE ? maximum : BLOCKSIZE;
563 if (full_write (STDOUT_FILENO, cursor, count) != count)
564 write_error (use_compress_program_option);
565 cursor += count;
566 maximum -= count;
567 }
568 }
569
570 xclose (STDOUT_FILENO);
571
572 wait_for_grandchild (grandchild_pid);
573 }
574
575 \f
576
577 static void
578 dec_to_env (char *envar, uintmax_t num)
579 {
580 char buf[UINTMAX_STRSIZE_BOUND];
581 char *numstr;
582
583 numstr = STRINGIFY_BIGINT (num, buf);
584 if (setenv (envar, numstr, 1) != 0)
585 xalloc_die ();
586 }
587
588 static void
589 time_to_env (char *envar, struct timespec t)
590 {
591 char buf[TIMESPEC_STRSIZE_BOUND];
592 if (setenv (envar, code_timespec (t, buf), 1) != 0)
593 xalloc_die ();
594 }
595
596 static void
597 oct_to_env (char *envar, unsigned long num)
598 {
599 char buf[1+1+(sizeof(unsigned long)*CHAR_BIT+2)/3];
600
601 snprintf (buf, sizeof buf, "0%lo", num);
602 if (setenv (envar, buf, 1) != 0)
603 xalloc_die ();
604 }
605
606 static void
607 str_to_env (char *envar, char const *str)
608 {
609 if (str)
610 {
611 if (setenv (envar, str, 1) != 0)
612 xalloc_die ();
613 }
614 else
615 unsetenv (envar);
616 }
617
618 static void
619 chr_to_env (char *envar, char c)
620 {
621 char buf[2];
622 buf[0] = c;
623 buf[1] = 0;
624 if (setenv (envar, buf, 1) != 0)
625 xalloc_die ();
626 }
627
628 static void
629 stat_to_env (char *name, char type, struct tar_stat_info *st)
630 {
631 str_to_env ("TAR_VERSION", PACKAGE_VERSION);
632 chr_to_env ("TAR_FILETYPE", type);
633 oct_to_env ("TAR_MODE", st->stat.st_mode);
634 str_to_env ("TAR_FILENAME", name);
635 str_to_env ("TAR_REALNAME", st->file_name);
636 str_to_env ("TAR_UNAME", st->uname);
637 str_to_env ("TAR_GNAME", st->gname);
638 time_to_env ("TAR_ATIME", st->atime);
639 time_to_env ("TAR_MTIME", st->mtime);
640 time_to_env ("TAR_CTIME", st->ctime);
641 dec_to_env ("TAR_SIZE", st->stat.st_size);
642 dec_to_env ("TAR_UID", st->stat.st_uid);
643 dec_to_env ("TAR_GID", st->stat.st_gid);
644
645 switch (type)
646 {
647 case 'b':
648 case 'c':
649 dec_to_env ("TAR_MINOR", minor (st->stat.st_rdev));
650 dec_to_env ("TAR_MAJOR", major (st->stat.st_rdev));
651 unsetenv ("TAR_LINKNAME");
652 break;
653
654 case 'l':
655 case 'h':
656 unsetenv ("TAR_MINOR");
657 unsetenv ("TAR_MAJOR");
658 str_to_env ("TAR_LINKNAME", st->link_name);
659 break;
660
661 default:
662 unsetenv ("TAR_MINOR");
663 unsetenv ("TAR_MAJOR");
664 unsetenv ("TAR_LINKNAME");
665 break;
666 }
667 }
668
669 static pid_t global_pid;
670 static RETSIGTYPE (*pipe_handler) (int sig);
671
672 int
673 sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st)
674 {
675 int p[2];
676 char *argv[4];
677
678 xpipe (p);
679 pipe_handler = signal (SIGPIPE, SIG_IGN);
680 global_pid = xfork ();
681
682 if (global_pid != 0)
683 {
684 xclose (p[PREAD]);
685 return p[PWRITE];
686 }
687
688 /* Child */
689 xdup2 (p[PREAD], STDIN_FILENO);
690 xclose (p[PWRITE]);
691
692 stat_to_env (file_name, typechar, st);
693
694 argv[0] = "/bin/sh";
695 argv[1] = "-c";
696 argv[2] = to_command_option;
697 argv[3] = NULL;
698
699 execv ("/bin/sh", argv);
700
701 exec_fatal (file_name);
702 }
703
704 void
705 sys_wait_command (void)
706 {
707 int status;
708
709 if (global_pid < 0)
710 return;
711
712 signal (SIGPIPE, pipe_handler);
713 while (waitpid (global_pid, &status, 0) == -1)
714 if (errno != EINTR)
715 {
716 global_pid = -1;
717 waitpid_error (to_command_option);
718 return;
719 }
720
721 if (WIFEXITED (status))
722 {
723 if (!ignore_command_error_option && WEXITSTATUS (status))
724 ERROR ((0, 0, _("%lu: Child returned status %d"),
725 (unsigned long) global_pid, WEXITSTATUS (status)));
726 }
727 else if (WIFSIGNALED (status))
728 {
729 WARN ((0, 0, _("%lu: Child terminated on signal %d"),
730 (unsigned long) global_pid, WTERMSIG (status)));
731 }
732 else
733 ERROR ((0, 0, _("%lu: Child terminated on unknown reason"),
734 (unsigned long) global_pid));
735
736 global_pid = -1;
737 }
738
739 int
740 sys_exec_info_script (const char **archive_name, int volume_number)
741 {
742 pid_t pid;
743 char *argv[4];
744 char uintbuf[UINTMAX_STRSIZE_BOUND];
745 int p[2];
746 static RETSIGTYPE (*saved_handler) (int sig);
747
748 xpipe (p);
749 saved_handler = signal (SIGPIPE, SIG_IGN);
750
751 pid = xfork ();
752
753 if (pid != 0)
754 {
755 /* Master */
756
757 int rc;
758 int status;
759 char *buf = NULL;
760 size_t size = 0;
761 FILE *fp;
762
763 xclose (p[PWRITE]);
764 fp = fdopen (p[PREAD], "r");
765 rc = getline (&buf, &size, fp);
766 fclose (fp);
767
768 if (rc > 0 && buf[rc-1] == '\n')
769 buf[--rc] = 0;
770
771 while (waitpid (pid, &status, 0) == -1)
772 if (errno != EINTR)
773 {
774 signal (SIGPIPE, saved_handler);
775 waitpid_error (info_script_option);
776 return -1;
777 }
778
779 signal (SIGPIPE, saved_handler);
780
781 if (WIFEXITED (status))
782 {
783 if (WEXITSTATUS (status) == 0 && rc > 0)
784 *archive_name = buf;
785 else
786 free (buf);
787 return WEXITSTATUS (status);
788 }
789
790 free (buf);
791 return -1;
792 }
793
794 /* Child */
795 setenv ("TAR_VERSION", PACKAGE_VERSION, 1);
796 setenv ("TAR_ARCHIVE", *archive_name, 1);
797 setenv ("TAR_VOLUME", STRINGIFY_BIGINT (volume_number, uintbuf), 1);
798 setenv ("TAR_BLOCKING_FACTOR",
799 STRINGIFY_BIGINT (blocking_factor, uintbuf), 1);
800 setenv ("TAR_SUBCOMMAND", subcommand_string (subcommand_option), 1);
801 setenv ("TAR_FORMAT",
802 archive_format_string (current_format == DEFAULT_FORMAT ?
803 archive_format : current_format), 1);
804 setenv ("TAR_FD", STRINGIFY_BIGINT (p[PWRITE], uintbuf), 1);
805
806 xclose (p[PREAD]);
807
808 argv[0] = "/bin/sh";
809 argv[1] = "-c";
810 argv[2] = (char*) info_script_option;
811 argv[3] = NULL;
812
813 execv (argv[0], argv);
814
815 exec_fatal (info_script_option);
816 }
817
818 void
819 sys_exec_checkpoint_script (const char *script_name,
820 const char *archive_name,
821 int checkpoint_number)
822 {
823 pid_t pid;
824 char *argv[4];
825 char uintbuf[UINTMAX_STRSIZE_BOUND];
826
827 pid = xfork ();
828
829 if (pid != 0)
830 {
831 /* Master */
832
833 int status;
834
835 while (waitpid (pid, &status, 0) == -1)
836 if (errno != EINTR)
837 {
838 waitpid_error (script_name);
839 break;
840 }
841
842 return;
843 }
844
845 /* Child */
846 setenv ("TAR_VERSION", PACKAGE_VERSION, 1);
847 setenv ("TAR_ARCHIVE", archive_name, 1);
848 setenv ("TAR_CHECKPOINT", STRINGIFY_BIGINT (checkpoint_number, uintbuf), 1);
849 setenv ("TAR_BLOCKING_FACTOR",
850 STRINGIFY_BIGINT (blocking_factor, uintbuf), 1);
851 setenv ("TAR_SUBCOMMAND", subcommand_string (subcommand_option), 1);
852 setenv ("TAR_FORMAT",
853 archive_format_string (current_format == DEFAULT_FORMAT ?
854 archive_format : current_format), 1);
855 argv[0] = "/bin/sh";
856 argv[1] = "-c";
857 argv[2] = (char*) script_name;
858 argv[3] = NULL;
859
860 execv (argv[0], argv);
861
862 exec_fatal (script_name);
863 }
864
865 #endif /* not MSDOS */
This page took 0.084486 seconds and 5 git commands to generate.