Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/pax Change how "cd .." is handled in next_file() with -M...



details:   https://anonhg.NetBSD.org/src/rev/2d01b52e1f99
branches:  trunk
changeset: 533360:2d01b52e1f99
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 11:29:45 2002 +0000

description:
Change how "cd .." is handled in next_file() with -M, to ensure that curdir[]
isn't addressed with a negative offset when back at the top of the tree.
This caused pax -M on sparc64 to generate corrupt tar files.
Problem found by Tim Goodwin <tjg%star.le.ac.uk@localhost> in [bin/17412].

diffstat:

 bin/pax/ftree.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 799f0e17a9cc -r 2d01b52e1f99 bin/pax/ftree.c
--- a/bin/pax/ftree.c   Fri Jun 28 09:35:23 2002 +0000
+++ b/bin/pax/ftree.c   Fri Jun 28 11:29:45 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftree.c,v 1.20 2002/04/20 23:36:48 lukem Exp $ */
+/*     $NetBSD: ftree.c,v 1.21 2002/06/28 11:29:45 lukem Exp $ */
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -78,7 +78,7 @@
 #if 0
 static char sccsid[] = "@(#)ftree.c    8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ftree.c,v 1.20 2002/04/20 23:36:48 lukem Exp $");
+__RCSID("$NetBSD: ftree.c,v 1.21 2002/06/28 11:29:45 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -542,11 +542,10 @@
                                        set_ftime(ftent->fts_path,
                                            mtime, atime, 1);
                                }
+                               ftnode = ftnode->parent;
                                if (ftnode->parent == ftnode)
                                        ftnode = NULL;
-                               else
-                                       ftnode = ftnode->parent;
-                               if (ftnode != NULL) {
+                               else {
                                        curdirlen -= strlen(ftnode->name) + 1;
                                        curdir[curdirlen] = '\0';
                                }



Home | Main Index | Thread Index | Old Index