From: Sergey Poznyakoff Date: Thu, 1 Dec 2005 14:50:57 +0000 (+0000) Subject: Obtain root_device here, to make sure it works correctly with -C. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;ds=sidebyside;h=ca43ee97694b4404db3798c9e1aa4d6a9d81ca39;p=chaz%2Ftar Obtain root_device here, to make sure it works correctly with -C. --- 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);