am a72512cd: Add O_CREAT option for open
* commit 'a72512cd058da7de4cdb667776ed47fad873f12c': Add O_CREAT option for open
This commit is contained in:
+10
-2
@@ -164,7 +164,11 @@ char* parse_recovery_command_file()
|
|||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
return 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");
|
FILE* fo = fdopen(fd, "w");
|
||||||
|
|
||||||
while (fgets(temp, sizeof(temp), f)) {
|
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;
|
struct stat sb;
|
||||||
int ret;
|
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");
|
FILE* mapf = fdopen(mapfd, "w");
|
||||||
|
|
||||||
ret = stat(path, &sb);
|
ret = stat(path, &sb);
|
||||||
|
|||||||
Reference in New Issue
Block a user