* extfs.c (read_archive): Free archive if the "list" command

returned non-zero, return -1.
Initial implemntation from Adam Byrtek <alpha@debian.org>
This commit is contained in:
Pavel Roskin 2002-12-25 21:42:59 +00:00
parent 10391e82cf
commit 9dc4fc6342
2 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2002-12-25 Pavel Roskin <proski@gnu.org>
* extfs.c (read_archive): Free archive if the "list" command
returned non-zero, return -1.
Initial implemntation from Adam Byrtek <alpha@debian.org>
2002-12-24 Pavel Roskin <proski@gnu.org> 2002-12-24 Pavel Roskin <proski@gnu.org>
* direntry.c (vfs_s_open): If the filesystem is read-only, * direntry.c (vfs_s_open): If the filesystem is read-only,

View File

@ -82,6 +82,7 @@ static struct entry *
find_entry (struct entry *dir, char *name, int make_dirs, int make_file); find_entry (struct entry *dir, char *name, int make_dirs, int make_file);
static int extfs_which (vfs *me, char *path); static int extfs_which (vfs *me, char *path);
static void remove_entry (struct entry *e); static void remove_entry (struct entry *e);
static void extfs_free (vfsid id);
static struct archive *first_archive = NULL; static struct archive *first_archive = NULL;
static int my_errno = 0; static int my_errno = 0;
@ -276,7 +277,7 @@ open_archive (int fstype, char *name, struct archive **pparc)
/* /*
* Main loop for reading an archive. * Main loop for reading an archive.
* Returns 0 on success, -1 on error. * Return 0 on success, -1 on error.
*/ */
static int static int
read_archive (int fstype, char *name, struct archive **pparc) read_archive (int fstype, char *name, struct archive **pparc)
@ -392,7 +393,15 @@ read_archive (int fstype, char *name, struct archive **pparc)
g_free (current_link_name); g_free (current_link_name);
} }
} }
pclose (extfsd);
/* Check if extfs 'list' returned 0 */
if (pclose (extfsd) != 0) {
g_free (buffer);
extfs_free (current_archive);
close_error_pipe (1, _("Inconsistent extfs archive"));
return -1;
}
close_error_pipe (1, NULL); close_error_pipe (1, NULL);
#ifdef SCO_FLAVOR #ifdef SCO_FLAVOR
waitpid (-1, NULL, WNOHANG); waitpid (-1, NULL, WNOHANG);