]> Dogcows Code - chaz/tar/blob - src/system.c
Do not try to drain the input pipe before closing the archive.
[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 ERROR ((0, 0, _("Child died with signal %d"), sig));
178 }
179 else if (WEXITSTATUS (wait_status) != 0)
180 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 /* Set ARCHIVE for writing, then compressing an archive. */
287 pid_t
288 sys_child_open_for_compress (void)
289 {
290 int parent_pipe[2];
291 int child_pipe[2];
292 pid_t grandchild_pid;
293 pid_t child_pid;
294 int wait_status;
295
296 xpipe (parent_pipe);
297 child_pid = xfork ();
298
299 if (child_pid > 0)
300 {
301 /* The parent tar is still here! Just clean up. */
302
303 archive = parent_pipe[PWRITE];
304 xclose (parent_pipe[PREAD]);
305 return child_pid;
306 }
307
308 /* The new born child tar is here! */
309
310 program_name = _("tar (child)");
311
312 xdup2 (parent_pipe[PREAD], STDIN_FILENO);
313 xclose (parent_pipe[PWRITE]);
314
315 /* Check if we need a grandchild tar. This happens only if either:
316 a) the file is to be accessed by rmt: compressor doesn't know how;
317 b) the file is not a plain file. */
318
319 if (!_remdev (archive_name_array[0])
320 && is_regular_file (archive_name_array[0]))
321 {
322 if (backup_option)
323 maybe_backup_file (archive_name_array[0], 1);
324
325 /* We don't need a grandchild tar. Open the archive and launch the
326 compressor. */
327 if (strcmp (archive_name_array[0], "-"))
328 {
329 archive = creat (archive_name_array[0], MODE_RW);
330 if (archive < 0)
331 {
332 int saved_errno = errno;
333
334 if (backup_option)
335 undo_last_backup ();
336 errno = saved_errno;
337 open_fatal (archive_name_array[0]);
338 }
339 xdup2 (archive, STDOUT_FILENO);
340 }
341 execlp (use_compress_program_option, use_compress_program_option, NULL);
342 exec_fatal (use_compress_program_option);
343 }
344
345 /* We do need a grandchild tar. */
346
347 xpipe (child_pipe);
348 grandchild_pid = xfork ();
349
350 if (grandchild_pid == 0)
351 {
352 /* The newborn grandchild tar is here! Launch the compressor. */
353
354 program_name = _("tar (grandchild)");
355
356 xdup2 (child_pipe[PWRITE], STDOUT_FILENO);
357 xclose (child_pipe[PREAD]);
358 execlp (use_compress_program_option, use_compress_program_option,
359 (char *) 0);
360 exec_fatal (use_compress_program_option);
361 }
362
363 /* The child tar is still here! */
364
365 /* Prepare for reblocking the data from the compressor into the archive. */
366
367 xdup2 (child_pipe[PREAD], STDIN_FILENO);
368 xclose (child_pipe[PWRITE]);
369
370 if (strcmp (archive_name_array[0], "-") == 0)
371 archive = STDOUT_FILENO;
372 else
373 {
374 archive = rmtcreat (archive_name_array[0], MODE_RW, rsh_command_option);
375 if (archive < 0)
376 open_fatal (archive_name_array[0]);
377 }
378
379 /* Let's read out of the stdin pipe and write an archive. */
380
381 while (1)
382 {
383 size_t status = 0;
384 char *cursor;
385 size_t length;
386
387 /* Assemble a record. */
388
389 for (length = 0, cursor = record_start->buffer;
390 length < record_size;
391 length += status, cursor += status)
392 {
393 size_t size = record_size - length;
394
395 status = safe_read (STDIN_FILENO, cursor, size);
396 if (status == SAFE_READ_ERROR)
397 read_fatal (use_compress_program_option);
398 if (status == 0)
399 break;
400 }
401
402 /* Copy the record. */
403
404 if (status == 0)
405 {
406 /* We hit the end of the file. Write last record at
407 full length, as the only role of the grandchild is
408 doing proper reblocking. */
409
410 if (length > 0)
411 {
412 memset (record_start->buffer + length, 0, record_size - length);
413 status = sys_write_archive_buffer ();
414 if (status != record_size)
415 archive_write_error (status);
416 }
417
418 /* There is nothing else to read, break out. */
419 break;
420 }
421
422 status = sys_write_archive_buffer ();
423 if (status != record_size)
424 archive_write_error (status);
425 }
426
427 /* Propagate any failure of the grandchild back to the parent. */
428
429 while (waitpid (grandchild_pid, &wait_status, 0) == -1)
430 if (errno != EINTR)
431 {
432 waitpid_error (use_compress_program_option);
433 break;
434 }
435
436 if (WIFSIGNALED (wait_status))
437 {
438 kill (child_pid, WTERMSIG (wait_status));
439 exit_status = TAREXIT_FAILURE;
440 }
441 else if (WEXITSTATUS (wait_status) != 0)
442 exit_status = WEXITSTATUS (wait_status);
443
444 exit (exit_status);
445 }
446
447 /* Set ARCHIVE for uncompressing, then reading an archive. */
448 pid_t
449 sys_child_open_for_uncompress (void)
450 {
451 int parent_pipe[2];
452 int child_pipe[2];
453 pid_t grandchild_pid;
454 pid_t child_pid;
455 int wait_status;
456
457 xpipe (parent_pipe);
458 child_pid = xfork ();
459
460 if (child_pid > 0)
461 {
462 /* The parent tar is still here! Just clean up. */
463
464 archive = parent_pipe[PREAD];
465 xclose (parent_pipe[PWRITE]);
466 return child_pid;
467 }
468
469 /* The newborn child tar is here! */
470
471 program_name = _("tar (child)");
472
473 xdup2 (parent_pipe[PWRITE], STDOUT_FILENO);
474 xclose (parent_pipe[PREAD]);
475
476 /* Check if we need a grandchild tar. This happens only if either:
477 a) we're reading stdin: to force unblocking;
478 b) the file is to be accessed by rmt: compressor doesn't know how;
479 c) the file is not a plain file. */
480
481 if (strcmp (archive_name_array[0], "-") != 0
482 && !_remdev (archive_name_array[0])
483 && is_regular_file (archive_name_array[0]))
484 {
485 /* We don't need a grandchild tar. Open the archive and lauch the
486 uncompressor. */
487
488 archive = open (archive_name_array[0], O_RDONLY | O_BINARY, MODE_RW);
489 if (archive < 0)
490 open_fatal (archive_name_array[0]);
491 xdup2 (archive, STDIN_FILENO);
492 execlp (use_compress_program_option, use_compress_program_option,
493 "-d", (char *) 0);
494 exec_fatal (use_compress_program_option);
495 }
496
497 /* We do need a grandchild tar. */
498
499 xpipe (child_pipe);
500 grandchild_pid = xfork ();
501
502 if (grandchild_pid == 0)
503 {
504 /* The newborn grandchild tar is here! Launch the uncompressor. */
505
506 program_name = _("tar (grandchild)");
507
508 xdup2 (child_pipe[PREAD], STDIN_FILENO);
509 xclose (child_pipe[PWRITE]);
510 execlp (use_compress_program_option, use_compress_program_option,
511 "-d", (char *) 0);
512 exec_fatal (use_compress_program_option);
513 }
514
515 /* The child tar is still here! */
516
517 /* Prepare for unblocking the data from the archive into the
518 uncompressor. */
519
520 xdup2 (child_pipe[PWRITE], STDOUT_FILENO);
521 xclose (child_pipe[PREAD]);
522
523 if (strcmp (archive_name_array[0], "-") == 0)
524 archive = STDIN_FILENO;
525 else
526 archive = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
527 MODE_RW, rsh_command_option);
528 if (archive < 0)
529 open_fatal (archive_name_array[0]);
530
531 /* Let's read the archive and pipe it into stdout. */
532
533 while (1)
534 {
535 char *cursor;
536 size_t maximum;
537 size_t count;
538 size_t status;
539
540 clear_read_error_count ();
541
542 error_loop:
543 status = rmtread (archive, record_start->buffer, record_size);
544 if (status == SAFE_READ_ERROR)
545 {
546 archive_read_error ();
547 goto error_loop;
548 }
549 if (status == 0)
550 break;
551 cursor = record_start->buffer;
552 maximum = status;
553 while (maximum)
554 {
555 count = maximum < BLOCKSIZE ? maximum : BLOCKSIZE;
556 if (full_write (STDOUT_FILENO, cursor, count) != count)
557 write_error (use_compress_program_option);
558 cursor += count;
559 maximum -= count;
560 }
561 }
562
563 xclose (STDOUT_FILENO);
564
565 /* Propagate any failure of the grandchild back to the parent. */
566
567 while (waitpid (grandchild_pid, &wait_status, 0) == -1)
568 if (errno != EINTR)
569 {
570 waitpid_error (use_compress_program_option);
571 break;
572 }
573
574 if (WIFSIGNALED (wait_status))
575 {
576 kill (child_pid, WTERMSIG (wait_status));
577 exit_status = TAREXIT_FAILURE;
578 }
579 else if (WEXITSTATUS (wait_status) != 0)
580 exit_status = WEXITSTATUS (wait_status);
581
582 exit (exit_status);
583 }
584
585 \f
586
587 static void
588 dec_to_env (char *envar, uintmax_t num)
589 {
590 char buf[UINTMAX_STRSIZE_BOUND];
591 char *numstr;
592
593 numstr = STRINGIFY_BIGINT (num, buf);
594 if (setenv (envar, numstr, 1) != 0)
595 xalloc_die ();
596 }
597
598 static void
599 time_to_env (char *envar, struct timespec t)
600 {
601 char buf[TIMESPEC_STRSIZE_BOUND];
602 if (setenv (envar, code_timespec (t, buf), 1) != 0)
603 xalloc_die ();
604 }
605
606 static void
607 oct_to_env (char *envar, unsigned long num)
608 {
609 char buf[1+1+(sizeof(unsigned long)*CHAR_BIT+2)/3];
610
611 snprintf (buf, sizeof buf, "0%lo", num);
612 if (setenv (envar, buf, 1) != 0)
613 xalloc_die ();
614 }
615
616 static void
617 str_to_env (char *envar, char const *str)
618 {
619 if (str)
620 {
621 if (setenv (envar, str, 1) != 0)
622 xalloc_die ();
623 }
624 else
625 unsetenv (envar);
626 }
627
628 static void
629 chr_to_env (char *envar, char c)
630 {
631 char buf[2];
632 buf[0] = c;
633 buf[1] = 0;
634 if (setenv (envar, buf, 1) != 0)
635 xalloc_die ();
636 }
637
638 static void
639 stat_to_env (char *name, char type, struct tar_stat_info *st)
640 {
641 str_to_env ("TAR_VERSION", PACKAGE_VERSION);
642 chr_to_env ("TAR_FILETYPE", type);
643 oct_to_env ("TAR_MODE", st->stat.st_mode);
644 str_to_env ("TAR_FILENAME", name);
645 str_to_env ("TAR_REALNAME", st->file_name);
646 str_to_env ("TAR_UNAME", st->uname);
647 str_to_env ("TAR_GNAME", st->gname);
648 time_to_env ("TAR_ATIME", st->atime);
649 time_to_env ("TAR_MTIME", st->mtime);
650 time_to_env ("TAR_CTIME", st->ctime);
651 dec_to_env ("TAR_SIZE", st->stat.st_size);
652 dec_to_env ("TAR_UID", st->stat.st_uid);
653 dec_to_env ("TAR_GID", st->stat.st_gid);
654
655 switch (type)
656 {
657 case 'b':
658 case 'c':
659 dec_to_env ("TAR_MINOR", minor (st->stat.st_rdev));
660 dec_to_env ("TAR_MAJOR", major (st->stat.st_rdev));
661 unsetenv ("TAR_LINKNAME");
662 break;
663
664 case 'l':
665 case 'h':
666 unsetenv ("TAR_MINOR");
667 unsetenv ("TAR_MAJOR");
668 str_to_env ("TAR_LINKNAME", st->link_name);
669 break;
670
671 default:
672 unsetenv ("TAR_MINOR");
673 unsetenv ("TAR_MAJOR");
674 unsetenv ("TAR_LINKNAME");
675 break;
676 }
677 }
678
679 static pid_t global_pid;
680 static RETSIGTYPE (*pipe_handler) (int sig);
681
682 int
683 sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st)
684 {
685 int p[2];
686 char *argv[4];
687
688 xpipe (p);
689 pipe_handler = signal (SIGPIPE, SIG_IGN);
690 global_pid = xfork ();
691
692 if (global_pid != 0)
693 {
694 xclose (p[PREAD]);
695 return p[PWRITE];
696 }
697
698 /* Child */
699 xdup2 (p[PREAD], STDIN_FILENO);
700 xclose (p[PWRITE]);
701
702 stat_to_env (file_name, typechar, st);
703
704 argv[0] = "/bin/sh";
705 argv[1] = "-c";
706 argv[2] = to_command_option;
707 argv[3] = NULL;
708
709 execv ("/bin/sh", argv);
710
711 exec_fatal (file_name);
712 }
713
714 void
715 sys_wait_command (void)
716 {
717 int status;
718
719 if (global_pid < 0)
720 return;
721
722 signal (SIGPIPE, pipe_handler);
723 while (waitpid (global_pid, &status, 0) == -1)
724 if (errno != EINTR)
725 {
726 global_pid = -1;
727 waitpid_error (to_command_option);
728 return;
729 }
730
731 if (WIFEXITED (status))
732 {
733 if (!ignore_command_error_option && WEXITSTATUS (status))
734 ERROR ((0, 0, _("%lu: Child returned status %d"),
735 (unsigned long) global_pid, WEXITSTATUS (status)));
736 }
737 else if (WIFSIGNALED (status))
738 {
739 WARN ((0, 0, _("%lu: Child terminated on signal %d"),
740 (unsigned long) global_pid, WTERMSIG (status)));
741 }
742 else
743 ERROR ((0, 0, _("%lu: Child terminated on unknown reason"),
744 (unsigned long) global_pid));
745
746 global_pid = -1;
747 }
748
749 int
750 sys_exec_info_script (const char **archive_name, int volume_number)
751 {
752 pid_t pid;
753 char *argv[4];
754 char uintbuf[UINTMAX_STRSIZE_BOUND];
755 int p[2];
756 static RETSIGTYPE (*saved_handler) (int sig);
757
758 xpipe (p);
759 saved_handler = signal (SIGPIPE, SIG_IGN);
760
761 pid = xfork ();
762
763 if (pid != 0)
764 {
765 /* Master */
766
767 int rc;
768 int status;
769 char *buf = NULL;
770 size_t size = 0;
771 FILE *fp;
772
773 xclose (p[PWRITE]);
774 fp = fdopen (p[PREAD], "r");
775 rc = getline (&buf, &size, fp);
776 fclose (fp);
777
778 if (rc > 0 && buf[rc-1] == '\n')
779 buf[--rc] = 0;
780
781 while (waitpid (pid, &status, 0) == -1)
782 if (errno != EINTR)
783 {
784 signal (SIGPIPE, saved_handler);
785 waitpid_error (info_script_option);
786 return -1;
787 }
788
789 signal (SIGPIPE, saved_handler);
790
791 if (WIFEXITED (status))
792 {
793 if (WEXITSTATUS (status) == 0 && rc > 0)
794 *archive_name = buf;
795 else
796 free (buf);
797 return WEXITSTATUS (status);
798 }
799
800 free (buf);
801 return -1;
802 }
803
804 /* Child */
805 setenv ("TAR_VERSION", PACKAGE_VERSION, 1);
806 setenv ("TAR_ARCHIVE", *archive_name, 1);
807 setenv ("TAR_VOLUME", STRINGIFY_BIGINT (volume_number, uintbuf), 1);
808 setenv ("TAR_BLOCKING_FACTOR",
809 STRINGIFY_BIGINT (blocking_factor, uintbuf), 1);
810 setenv ("TAR_SUBCOMMAND", subcommand_string (subcommand_option), 1);
811 setenv ("TAR_FORMAT",
812 archive_format_string (current_format == DEFAULT_FORMAT ?
813 archive_format : current_format), 1);
814 setenv ("TAR_FD", STRINGIFY_BIGINT (p[PWRITE], uintbuf), 1);
815
816 xclose (p[PREAD]);
817
818 argv[0] = "/bin/sh";
819 argv[1] = "-c";
820 argv[2] = (char*) info_script_option;
821 argv[3] = NULL;
822
823 execv (argv[0], argv);
824
825 exec_fatal (info_script_option);
826 }
827
828 void
829 sys_exec_checkpoint_script (const char *script_name,
830 const char *archive_name,
831 int checkpoint_number)
832 {
833 pid_t pid;
834 char *argv[4];
835 char uintbuf[UINTMAX_STRSIZE_BOUND];
836
837 pid = xfork ();
838
839 if (pid != 0)
840 {
841 /* Master */
842
843 int status;
844
845 while (waitpid (pid, &status, 0) == -1)
846 if (errno != EINTR)
847 {
848 waitpid_error (script_name);
849 break;
850 }
851
852 return;
853 }
854
855 /* Child */
856 setenv ("TAR_VERSION", PACKAGE_VERSION, 1);
857 setenv ("TAR_ARCHIVE", archive_name, 1);
858 setenv ("TAR_CHECKPOINT", STRINGIFY_BIGINT (checkpoint_number, uintbuf), 1);
859 setenv ("TAR_BLOCKING_FACTOR",
860 STRINGIFY_BIGINT (blocking_factor, uintbuf), 1);
861 setenv ("TAR_SUBCOMMAND", subcommand_string (subcommand_option), 1);
862 setenv ("TAR_FORMAT",
863 archive_format_string (current_format == DEFAULT_FORMAT ?
864 archive_format : current_format), 1);
865 argv[0] = "/bin/sh";
866 argv[1] = "-c";
867 argv[2] = (char*) script_name;
868 argv[3] = NULL;
869
870 execv (argv[0], argv);
871
872 exec_fatal (script_name);
873 }
874
875 #endif /* not MSDOS */
This page took 0.073445 seconds and 5 git commands to generate.