OSDN Git Service

ext4_utils: don't leave bad image file in case of error
authorJP Abgrall <jpa@google.com>
Sat, 15 Feb 2014 01:31:40 +0000 (17:31 -0800)
committerJP Abgrall <jpa@google.com>
Sat, 15 Feb 2014 01:31:40 +0000 (17:31 -0800)
Bug: 13029951
Change-Id: Ibe50a503c2d3988813b362790b7fba83383fb51e

ext4_utils/make_ext4fs_main.c

index b6c740d..754e51f 100644 (file)
@@ -203,6 +203,7 @@ int main(int argc, char **argv)
        exitcode = make_ext4fs_internal(fd, directory, mountpoint, fs_config_func, gzip,
                        sparse, crc, wipe, sehnd, verbose);
        close(fd);
-
+       if (exitcode && strcmp(filename, "-"))
+               unlink(filename);
        return exitcode;
 }