]> www.infradead.org Git - mtd-utils.git/commitdiff
mkfs.ubifs: abort add_directory if readdir fails
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Sun, 10 Nov 2019 13:40:05 +0000 (14:40 +0100)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Sun, 10 Nov 2019 13:44:24 +0000 (14:44 +0100)
The existing code sets 'err' to -1 and breaks the readdir loop, but
the error state is never read. This patch modifies the readdir loop
to actualy jump to the error handling branch if readdir fails.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
ubifs-utils/mkfs.ubifs/mkfs.ubifs.c

index 5748aaac0461fb716acdc3d3759a3e3df7088d3a..72ae1b4cbf7db47e17b672a2fdcd034bfe625290 100644 (file)
@@ -2043,8 +2043,7 @@ static int add_directory(const char *dir_name, ino_t dir_inum, struct stat *st,
                        if (errno == 0)
                                break;
                        sys_err_msg("error reading directory '%s'", dir_name);
-                       err = -1;
-                       break;
+                       goto out_free;
                }
 
                if (strcmp(".", entry->d_name) == 0)