OSDN Git Service

Add a mode to the open(2) call when creating the output file.
authorKen Sumrall <ksumrall@android.com>
Thu, 6 Jan 2011 05:00:03 +0000 (21:00 -0800)
committerKen Sumrall <ksumrall@android.com>
Fri, 7 Jan 2011 05:24:24 +0000 (21:24 -0800)
Without this, the mode of the created file is pulled from
garbage on the stack.

Change-Id: Idc5d2bdcaf66a4a70d37ff48e3f9d127542ad860

ext4_utils/simg2img.c

index f2e3149..a074b28 100644 (file)
@@ -177,7 +177,7 @@ int main(int argc, char *argv[])
        if (strcmp(argv[2], "-") == 0) {
                out = STDOUT_FILENO;
        } else {
-               if ((out = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC)) == 0) {
+               if ((out = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0666)) == 0) {
                        fprintf(stderr, "Cannot open output file %s\n", argv[2]);
                        exit(-1);
                }