summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2012-06-26 15:07:03 -0700
committerNick Kralevich <nnk@google.com>2012-06-26 15:07:03 -0700
commit4684e58a8d1d502012c48295233e6663043cfb0b (patch)
treee1b118400f4df2f71d533b15cb590f864e91ed4a
parentb405f3676038ba088edd4974bcecbcbfe094fc96 (diff)
downloadsystem_vold-4684e58a8d1d502012c48295233e6663043cfb0b.zip
system_vold-4684e58a8d1d502012c48295233e6663043cfb0b.tar.gz
system_vold-4684e58a8d1d502012c48295233e6663043cfb0b.tar.bz2
Add mode when open(O_CREAT) is used.
When creating a new file using open(..., O_CREAT), it is an error to fail to specify a creation mode. If a mode is not specified, a random stack provided value is used as the "mode". This will become a compile error in a future Android change. Change-Id: I761708c001247d7a2faac2e286288b45bfecc6f7
-rw-r--r--cryptfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cryptfs.c b/cryptfs.c
index e1c177d..e6439fe 100644
--- a/cryptfs.c
+++ b/cryptfs.c
@@ -1370,7 +1370,7 @@ int cryptfs_enable(char *howarg, char *passwd)
/* wipe data if encryption failed */
SLOGE("encryption failed - rebooting into recovery to wipe data\n");
mkdir("/cache/recovery", 0700);
- int fd = open("/cache/recovery/command", O_RDWR|O_CREAT|O_TRUNC);
+ int fd = open("/cache/recovery/command", O_RDWR|O_CREAT|O_TRUNC, 0600);
if (fd >= 0) {
write(fd, "--wipe_data", strlen("--wipe_data") + 1);
close(fd);