summaryrefslogtreecommitdiffstats
path: root/uncrypt/uncrypt.c
diff options
context:
space:
mode:
authorSungmin Choi <sungmin.choi@lge.com>2014-12-10 13:57:09 +0100
committerThe Android Automerger <android-build@android.com>2014-12-11 11:56:49 +0100
commit8002104d3610d5f19e17b3b505b238af10129b0c (patch)
tree727566ab86238522e57ef942507bc0e4036216a4 /uncrypt/uncrypt.c
parentmerge in lmp-mr1-release history after reset to lmp-mr1-dev (diff)
downloadandroid_bootable_recovery-8002104d3610d5f19e17b3b505b238af10129b0c.tar
android_bootable_recovery-8002104d3610d5f19e17b3b505b238af10129b0c.tar.gz
android_bootable_recovery-8002104d3610d5f19e17b3b505b238af10129b0c.tar.bz2
android_bootable_recovery-8002104d3610d5f19e17b3b505b238af10129b0c.tar.lz
android_bootable_recovery-8002104d3610d5f19e17b3b505b238af10129b0c.tar.xz
android_bootable_recovery-8002104d3610d5f19e17b3b505b238af10129b0c.tar.zst
android_bootable_recovery-8002104d3610d5f19e17b3b505b238af10129b0c.zip
Diffstat (limited to '')
-rw-r--r--uncrypt/uncrypt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/uncrypt/uncrypt.c b/uncrypt/uncrypt.c
index 361c80483..7fb0989a7 100644
--- a/uncrypt/uncrypt.c
+++ b/uncrypt/uncrypt.c
@@ -164,7 +164,11 @@ char* parse_recovery_command_file()
if (f == NULL) {
return NULL;
}
- int fd = open(RECOVERY_COMMAND_FILE_TMP, O_WRONLY | O_SYNC);
+ int fd = open(RECOVERY_COMMAND_FILE_TMP, O_WRONLY | O_CREAT | O_SYNC, S_IRUSR | S_IWUSR);
+ if (fd < 0) {
+ ALOGE("failed to open %s\n", RECOVERY_COMMAND_FILE_TMP);
+ return NULL;
+ }
FILE* fo = fdopen(fd, "w");
while (fgets(temp, sizeof(temp), f)) {
@@ -192,7 +196,11 @@ int produce_block_map(const char* path, const char* map_file, const char* blk_de
struct stat sb;
int ret;
- int mapfd = open(map_file, O_WRONLY | O_SYNC);
+ int mapfd = open(map_file, O_WRONLY | O_CREAT | O_SYNC, S_IRUSR | S_IWUSR);
+ if (mapfd < 0) {
+ ALOGE("failed to open %s\n", map_file);
+ return -1;
+ }
FILE* mapf = fdopen(mapfd, "w");
ret = stat(path, &sb);