X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fextract.c;h=89db09c8b20b81b39554dc590d60360111e18da9;hb=2e7a943d0ea47fd679469f20409a7c6673993522;hp=c89ebd01e74c4a1acb7abffd0b6fabc3f0e83892;hpb=5249a993776ba32c851cf6eb3734958512d55d11;p=chaz%2Ftar diff --git a/src/extract.c b/src/extract.c index c89ebd0..89db09c 100644 --- a/src/extract.c +++ b/src/extract.c @@ -120,19 +120,6 @@ extr_init (void) same_permissions_option += we_are_root; same_owner_option += we_are_root; - /* Save 'root device' to avoid purging mount points. - FIXME: Should the same be done after handling -C option ? */ - if (one_file_system_option) - { - struct stat st; - char *dir = xgetcwd (); - - if (deref_stat (true, dir, &st)) - stat_diag (dir); - else - root_device = st.st_dev; - } - /* Option -p clears the kernel umask, so it does not affect proper restoration of file permissions. New intermediate directories will comply with umask at start of program. */ @@ -626,6 +613,19 @@ extract_dir (char *file_name, int typeflag) mode_t mode; int interdir_made = 0; + /* Save 'root device' to avoid purging mount points. */ + if (one_file_system_option && root_device == 0) + { + struct stat st; + char *dir = xgetcwd (); + + if (deref_stat (true, dir, &st)) + stat_diag (dir); + else + root_device = st.st_dev; + free (dir); + } + if (incremental_option) /* Read the entry and delete files that aren't listed in the archive. */ purge_directory (file_name);