Changeset dbbcad4 in freewrt for tools/paxmirabilis/src/ar_subs.c
- Timestamp:
- Jul 16, 2006, 6:17:53 PM (19 years ago)
- Branches:
- freewrt_1_0, freewrt_2_0
- Children:
- 006f3d5
- Parents:
- 53c89c6
- File:
-
- 1 edited
-
tools/paxmirabilis/src/ar_subs.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tools/paxmirabilis/src/ar_subs.c
r53c89c6 rdbbcad4 1 /** $MirOS: src/bin/pax/ar_subs.c,v 1.4 2006/07/16 16:14:50 tg Exp $ */ 1 2 /* $OpenBSD: ar_subs.c,v 1.29 2006/01/25 17:42:08 markus Exp $ */ 2 3 /* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */ … … 35 36 */ 36 37 37 #ifndef lint 38 #if 0 39 static const char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"; 40 #else 41 static const char rcsid[] = "$OpenBSD: ar_subs.c,v 1.29 2006/01/25 17:42:08 markus Exp $"; 42 #endif 43 #endif /* not lint */ 44 45 #include <sys/types.h> 38 #include <sys/param.h> 46 39 #include <sys/time.h> 47 40 #include <sys/stat.h> 48 #include <sys/param.h>49 41 #include <signal.h> 50 42 #include <string.h> … … 56 48 #include "pax.h" 57 49 #include "extern.h" 50 #include "options.h" 51 52 __SCCSID("@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"); 53 __RCSID("$MirOS: src/bin/pax/ar_subs.c,v 1.4 2006/07/16 16:14:50 tg Exp $"); 58 54 59 55 static void wr_archive(ARCHD *, int is_app); … … 302 298 */ 303 299 if ((arcn->pat != NULL) && (arcn->pat->chdname != NULL)) 304 if ( chdir(arcn->pat->chdname) != 0)300 if (!to_stdout && chdir(arcn->pat->chdname) != 0) 305 301 syswarn(1, errno, "Cannot chdir to %s", 306 302 arcn->pat->chdname); … … 315 311 * header (as determined by the format). 316 312 */ 317 if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) 318 res = lnk_creat(arcn); 319 else 320 res = node_creat(arcn); 313 if (!to_stdout) { 314 if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) 315 res = lnk_creat(arcn); 316 else 317 res = node_creat(arcn); 318 } 321 319 322 320 (void)rd_skip(arcn->skip + arcn->pad); … … 334 332 * over the data and purge the name from hard link table 335 333 */ 336 if ((fd = file_creat(arcn)) < 0) { 334 if (to_stdout) 335 fd = STDOUT_FILENO; 336 else if ((fd = file_creat(arcn)) < 0) { 337 337 (void)rd_skip(arcn->skip + arcn->pad); 338 338 purg_lnk(arcn); … … 344 344 */ 345 345 res = (*frmt->rd_data)(arcn, fd, &cnt); 346 file_close(arcn, fd); 346 if (fd != STDOUT_FILENO) 347 file_close(arcn, fd); 347 348 if (vflag && vfpart) { 348 349 (void)putc('\n', listf); … … 356 357 */ 357 358 if ((arcn->pat != NULL) && (arcn->pat->chdname != NULL)) 358 if ( fchdir(cwdfd) != 0)359 if (!to_stdout && fchdir(cwdfd) != 0) 359 360 syswarn(1, errno, 360 361 "Can't fchdir to starting directory"); … … 398 399 399 400 /* 400 * if this is not append, and there are no files, we do not write a 401 * if this is not append, and there are no files, we do not write a 401 402 * trailer 402 403 */
Note:
See TracChangeset
for help on using the changeset viewer.
