From: Michihiro NAKAJIMA Date: Mon, 3 Jan 2011 09:54:49 +0000 (-0500) Subject: Do not find out a filesystem status when the symlink is broken. X-Git-Tag: v3.0.0a~789 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=691487d8486d6855231a4bdc5cfebe0b8ee4e882;p=thirdparty%2Flibarchive.git Do not find out a filesystem status when the symlink is broken. statfs will be failed by its brokenness. SVN-Revision: 2857 --- diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index b3195609c..f700e07c2 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -862,6 +862,16 @@ update_filesystem(struct archive_read_disk *a, int64_t dev) t->current_filesystem->name_max = PATH_MAX; # endif /* NAME_MAX */ #endif /* HAVE_READDIR_R */ + + /* + * When symlink is broken, we cannot find out what current + * filesystem is. + */ + if (tree_current_stat(a->tree) == NULL) { + t->current_filesystem->synthetic = -1;/* Not supported */ + t->current_filesystem->remote = -1;/* Not supported */ + return (ARCHIVE_OK); + } return (setup_current_filesystem(a)); } diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c index 1afb1fdc0..5e871ee94 100644 --- a/libarchive/archive_read_disk_windows.c +++ b/libarchive/archive_read_disk_windows.c @@ -951,6 +951,16 @@ update_filesystem(struct archive_read_disk *a, int64_t dev) t->current_filesystem_id = fid; t->current_filesystem = &(t->filesystem_table[fid]); t->current_filesystem->dev = dev; + + /* + * When symlink is broken, we cannot find out what current + * filesystem is. + */ + if (tree_current_stat(a->tree) == NULL) { + t->current_filesystem->synthetic = -1;/* Not supported */ + t->current_filesystem->remote = -1;/* Not supported */ + return (ARCHIVE_OK); + } return (setup_current_filesystem(a)); }