sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit b5b7db400905a98319c2b8978156565c68247fa5
parent 50d93057523bfd3b459e2003f6fef8712c2634ec
Author: David Galos <galosd83@students.rowan.edu>
Date:   Sun, 28 Jul 2013 12:12:03 -0400

tar: Check inode AND dev before ignoring a file. Thanks, Lars Lindqvist!

Diffstat:
Mtar.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tar.c b/tar.c @@ -48,6 +48,7 @@ static void xt(int (*)(char*, int, char[Blksiz])); static FILE *tarfile; static ino_t tarinode; +static dev_t tardev; static void usage(void) @@ -126,6 +127,7 @@ main(int argc, char *argv[]) if (lstat(file, &st) < 0) eprintf("tar: stat '%s':", file); tarinode = st.st_ino; + tardev = st.st_dev; } else { tarfile = (mode == 'c') ? stdout : stdin; } @@ -161,7 +163,7 @@ archive(const char* path, const struct stat* sta, int type) mode_t mode; lstat(path, &st); - if (st.st_ino == tarinode) { + if (st.st_ino == tarinode && st.st_dev == tardev) { fprintf(stderr, "ignoring '%s'\n", path); return 0; }