diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/dircache.c | 2 | ||||
-rw-r--r-- | firmware/common/file.c | 4 | ||||
-rw-r--r-- | firmware/font.c | 2 | ||||
-rw-r--r-- | firmware/include/file.h | 10 | ||||
-rw-r--r-- | firmware/profile.c | 2 | ||||
-rw-r--r-- | firmware/target/sh/archos/recorder/powermgmt-recorder.c | 2 | ||||
-rw-r--r-- | firmware/test/fat/main.c | 2 |
7 files changed, 14 insertions, 10 deletions
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 495366f5d8..225ed1aff1 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c | |||
@@ -557,7 +557,7 @@ int dircache_save(void) | |||
557 | return -1; | 557 | return -1; |
558 | 558 | ||
559 | logf("Saving directory cache"); | 559 | logf("Saving directory cache"); |
560 | fd = open(DIRCACHE_FILE, O_WRONLY | O_CREAT | O_TRUNC); | 560 | fd = open(DIRCACHE_FILE, O_WRONLY | O_CREAT | O_TRUNC, 0666); |
561 | 561 | ||
562 | maindata.magic = DIRCACHE_MAGIC; | 562 | maindata.magic = DIRCACHE_MAGIC; |
563 | maindata.size = dircache_size; | 563 | maindata.size = dircache_size; |
diff --git a/firmware/common/file.c b/firmware/common/file.c index 05612cd75e..438a7106ca 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -57,7 +57,7 @@ static int flush_cache(int fd); | |||
57 | 57 | ||
58 | int file_creat(const char *pathname) | 58 | int file_creat(const char *pathname) |
59 | { | 59 | { |
60 | return open(pathname, O_WRONLY|O_CREAT|O_TRUNC); | 60 | return open(pathname, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
61 | } | 61 | } |
62 | 62 | ||
63 | static int open_internal(const char* pathname, int flags, bool use_cache) | 63 | static int open_internal(const char* pathname, int flags, bool use_cache) |
@@ -228,7 +228,7 @@ static int open_internal(const char* pathname, int flags, bool use_cache) | |||
228 | return fd; | 228 | return fd; |
229 | } | 229 | } |
230 | 230 | ||
231 | int open(const char* pathname, int flags) | 231 | int file_open(const char* pathname, int flags) |
232 | { | 232 | { |
233 | /* By default, use the dircache if available. */ | 233 | /* By default, use the dircache if available. */ |
234 | return open_internal(pathname, flags, true); | 234 | return open_internal(pathname, flags, true); |
diff --git a/firmware/font.c b/firmware/font.c index 6877d7e1ff..f1584713ed 100644 --- a/firmware/font.c +++ b/firmware/font.c | |||
@@ -607,7 +607,7 @@ void glyph_cache_save(struct font* pf) | |||
607 | if (pf->fd >= 0 && pf == &font_ui) | 607 | if (pf->fd >= 0 && pf == &font_ui) |
608 | { | 608 | { |
609 | #ifdef WPSEDITOR | 609 | #ifdef WPSEDITOR |
610 | cache_fd = open(GLYPH_CACHE_FILE, O_WRONLY|O_CREAT|O_TRUNC); | 610 | cache_fd = open(GLYPH_CACHE_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
611 | #else | 611 | #else |
612 | cache_fd = creat(GLYPH_CACHE_FILE, 0666); | 612 | cache_fd = creat(GLYPH_CACHE_FILE, 0666); |
613 | #endif | 613 | #endif |
diff --git a/firmware/include/file.h b/firmware/include/file.h index b60c744549..ec0ab87759 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h | |||
@@ -49,7 +49,7 @@ | |||
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC) | 51 | #if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC) |
52 | #define open(x,y) sim_open(x,y) | 52 | #define open(x, ...) sim_open(x, __VA_ARGS__) |
53 | #define creat(x,m) sim_creat(x,m) | 53 | #define creat(x,m) sim_creat(x,m) |
54 | #define remove(x) sim_remove(x) | 54 | #define remove(x) sim_remove(x) |
55 | #define rename(x,y) sim_rename(x,y) | 55 | #define rename(x,y) sim_rename(x,y) |
@@ -61,16 +61,17 @@ | |||
61 | #define write(x,y,z) sim_write(x,y,z) | 61 | #define write(x,y,z) sim_write(x,y,z) |
62 | #define close(x) sim_close(x) | 62 | #define close(x) sim_close(x) |
63 | extern int sim_creat(const char *pathname, mode_t mode); | 63 | extern int sim_creat(const char *pathname, mode_t mode); |
64 | extern int sim_open(const char *pathname, int flags, ...); | ||
64 | #endif | 65 | #endif |
65 | 66 | ||
66 | typedef int (*open_func)(const char* pathname, int flags); | 67 | typedef int (*open_func)(const char* pathname, int flags, ...); |
67 | typedef ssize_t (*read_func)(int fd, void *buf, size_t count); | 68 | typedef ssize_t (*read_func)(int fd, void *buf, size_t count); |
68 | typedef int (*creat_func)(const char *pathname, mode_t mode); | 69 | typedef int (*creat_func)(const char *pathname, mode_t mode); |
69 | typedef ssize_t (*write_func)(int fd, const void *buf, size_t count); | 70 | typedef ssize_t (*write_func)(int fd, const void *buf, size_t count); |
70 | typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, | 71 | typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, |
71 | int(*_compar)(const void *, const void *)); | 72 | int(*_compar)(const void *, const void *)); |
72 | 73 | ||
73 | extern int open(const char* pathname, int flags); | 74 | extern int file_open(const char* pathname, int flags); |
74 | extern int close(int fd); | 75 | extern int close(int fd); |
75 | extern int fsync(int fd); | 76 | extern int fsync(int fd); |
76 | extern ssize_t read(int fd, void *buf, size_t count); | 77 | extern ssize_t read(int fd, void *buf, size_t count); |
@@ -83,6 +84,9 @@ static inline int creat(const char *pathname, mode_t mode) | |||
83 | (void)mode; | 84 | (void)mode; |
84 | return file_creat(pathname); | 85 | return file_creat(pathname); |
85 | } | 86 | } |
87 | #if !defined(CODEC) && !defined(PLUGIN) | ||
88 | #define open(x, y, ...) file_open(x,y) | ||
89 | #endif | ||
86 | #endif | 90 | #endif |
87 | extern ssize_t write(int fd, const void *buf, size_t count); | 91 | extern ssize_t write(int fd, const void *buf, size_t count); |
88 | extern int remove(const char* pathname); | 92 | extern int remove(const char* pathname); |
diff --git a/firmware/profile.c b/firmware/profile.c index 6700eca404..30a1e9fccc 100644 --- a/firmware/profile.c +++ b/firmware/profile.c | |||
@@ -189,7 +189,7 @@ void profstop() { | |||
189 | unsigned short current_index; | 189 | unsigned short current_index; |
190 | timer_unregister(); | 190 | timer_unregister(); |
191 | profiling = PROF_OFF; | 191 | profiling = PROF_OFF; |
192 | fd = open("/profile.out", O_WRONLY|O_CREAT|O_TRUNC); | 192 | fd = open("/profile.out", O_WRONLY|O_CREAT|O_TRUNC, 0666); |
193 | if (profiling_exit == PROF_ERROR) { | 193 | if (profiling_exit == PROF_ERROR) { |
194 | fdprintf(fd,"Profiling exited with an error.\n"); | 194 | fdprintf(fd,"Profiling exited with an error.\n"); |
195 | fdprintf(fd,"Overflow or timer stolen most likely.\n"); | 195 | fdprintf(fd,"Overflow or timer stolen most likely.\n"); |
diff --git a/firmware/target/sh/archos/recorder/powermgmt-recorder.c b/firmware/target/sh/archos/recorder/powermgmt-recorder.c index 7b1842016c..70373a30ec 100644 --- a/firmware/target/sh/archos/recorder/powermgmt-recorder.c +++ b/firmware/target/sh/archos/recorder/powermgmt-recorder.c | |||
@@ -125,7 +125,7 @@ static void debug_file_log(void) | |||
125 | debug_file_close(); | 125 | debug_file_close(); |
126 | } | 126 | } |
127 | else if (fd < 0) { | 127 | else if (fd < 0) { |
128 | fd = open(DEBUG_FILE_NAME, O_WRONLY | O_APPEND | O_CREAT); | 128 | fd = open(DEBUG_FILE_NAME, O_WRONLY | O_APPEND | O_CREAT, 0666); |
129 | 129 | ||
130 | if (fd >= 0) { | 130 | if (fd >= 0) { |
131 | snprintf(debug_message, DEBUG_MESSAGE_LEN, | 131 | snprintf(debug_message, DEBUG_MESSAGE_LEN, |
diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c index e190d81045..1cb53deb6e 100644 --- a/firmware/test/fat/main.c +++ b/firmware/test/fat/main.c | |||
@@ -356,7 +356,7 @@ int dbg_test(char* name) | |||
356 | for (j=0; j<5; j++) { | 356 | for (j=0; j<5; j++) { |
357 | int num = 40960; | 357 | int num = 40960; |
358 | 358 | ||
359 | fd = open(name,O_WRONLY|O_CREAT|O_APPEND); | 359 | fd = open(name,O_WRONLY|O_CREAT|O_APPEND, 0666); |
360 | if (fd<0) { | 360 | if (fd<0) { |
361 | DEBUGF("Failed opening file\n"); | 361 | DEBUGF("Failed opening file\n"); |
362 | return -1; | 362 | return -1; |