diff options
Diffstat (limited to 'apps/plugins')
47 files changed, 73 insertions, 68 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 5c04892d61..165ce54634 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c | |||
@@ -336,7 +336,7 @@ static void flush_buffer(void* data) | |||
336 | if (in_usb_mode || (buf_idx == 0)) | 336 | if (in_usb_mode || (buf_idx == 0)) |
337 | return; | 337 | return; |
338 | 338 | ||
339 | fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND); | 339 | fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND, 0666); |
340 | if (fd < 0) | 340 | if (fd < 0) |
341 | return; | 341 | return; |
342 | 342 | ||
@@ -446,7 +446,7 @@ void thread(void) | |||
446 | rb->unregister_storage_idle_func(flush_buffer, true); | 446 | rb->unregister_storage_idle_func(flush_buffer, true); |
447 | 447 | ||
448 | /* log end of bench and exit reason */ | 448 | /* log end of bench and exit reason */ |
449 | fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND); | 449 | fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND, 0666); |
450 | if (fd >= 0) | 450 | if (fd >= 0) |
451 | { | 451 | { |
452 | rb->fdprintf(fd, "--Battery bench ended, reason: %s--\n", exit_reason); | 452 | rb->fdprintf(fd, "--Battery bench ended, reason: %s--\n", exit_reason); |
@@ -525,7 +525,7 @@ int main(void) | |||
525 | fd = rb->open(BATTERY_LOG, O_RDONLY); | 525 | fd = rb->open(BATTERY_LOG, O_RDONLY); |
526 | if (fd < 0) | 526 | if (fd < 0) |
527 | { | 527 | { |
528 | fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT); | 528 | fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT, 0666); |
529 | if (fd >= 0) | 529 | if (fd >= 0) |
530 | { | 530 | { |
531 | rb->fdprintf(fd, | 531 | rb->fdprintf(fd, |
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index 1af26f290f..7b3dbef805 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c | |||
@@ -871,7 +871,7 @@ static void blackjack_savegame(struct game_context* bj) { | |||
871 | if(!resume) | 871 | if(!resume) |
872 | return; | 872 | return; |
873 | /* write out the game state to the save file */ | 873 | /* write out the game state to the save file */ |
874 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT); | 874 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT, 0666); |
875 | if(fd < 0) | 875 | if(fd < 0) |
876 | return; | 876 | return; |
877 | rb->write(fd, bj, sizeof(struct game_context)); | 877 | rb->write(fd, bj, sizeof(struct game_context)); |
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index 60e8f3820b..98de3d439f 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c | |||
@@ -1265,7 +1265,7 @@ static void brickmania_savegame(void) | |||
1265 | int fd; | 1265 | int fd; |
1266 | 1266 | ||
1267 | /* write out the game state to the save file */ | 1267 | /* write out the game state to the save file */ |
1268 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT); | 1268 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT, 0666); |
1269 | if(fd < 0) return; | 1269 | if(fd < 0) return; |
1270 | 1270 | ||
1271 | if ((rb->write(fd, &pad_pos_x, sizeof(pad_pos_x)) <= 0) || | 1271 | if ((rb->write(fd, &pad_pos_x, sizeof(pad_pos_x)) <= 0) || |
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index a3de9d2511..514621224a 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c | |||
@@ -2212,7 +2212,7 @@ static void bubbles_savedata(void) { | |||
2212 | if (last_highlevel >= highlevel) /* no need to save */ | 2212 | if (last_highlevel >= highlevel) /* no need to save */ |
2213 | return; | 2213 | return; |
2214 | 2214 | ||
2215 | fd = rb->open(DATA_FILE, O_WRONLY|O_CREAT); | 2215 | fd = rb->open(DATA_FILE, O_WRONLY|O_CREAT, 0666); |
2216 | if (fd < 0) return; | 2216 | if (fd < 0) return; |
2217 | 2217 | ||
2218 | rb->write(fd, &highlevel, sizeof(highlevel)); | 2218 | rb->write(fd, &highlevel, sizeof(highlevel)); |
@@ -2252,7 +2252,7 @@ static void bubbles_savegame(struct game_context* bb) { | |||
2252 | if (!resume) /* nothing to save */ | 2252 | if (!resume) /* nothing to save */ |
2253 | return; | 2253 | return; |
2254 | /* write out the game state to the save file */ | 2254 | /* write out the game state to the save file */ |
2255 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT); | 2255 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT, 0666); |
2256 | if (fd < 0) | 2256 | if (fd < 0) |
2257 | { | 2257 | { |
2258 | rb->splash(HZ/2, "Failed to save game"); | 2258 | rb->splash(HZ/2, "Failed to save game"); |
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 3589998e47..13abdfc29a 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c | |||
@@ -611,7 +611,7 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown) | |||
611 | { | 611 | { |
612 | int fp, fq; | 612 | int fp, fq; |
613 | /* use O_RDWR|O_CREAT so that file is created if it doesn't exist. */ | 613 | /* use O_RDWR|O_CREAT so that file is created if it doesn't exist. */ |
614 | fp = rb->open(MEMO_FILE, O_RDWR|O_CREAT); | 614 | fp = rb->open(MEMO_FILE, O_RDWR|O_CREAT, 0666); |
615 | fq = rb->creat(TEMP_FILE, 0666); | 615 | fq = rb->creat(TEMP_FILE, 0666); |
616 | if ( (fq > -1) && (fp > -1) ) | 616 | if ( (fq > -1) && (fp > -1) ) |
617 | { | 617 | { |
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index 72a8b238a8..45f052d30a 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c | |||
@@ -275,7 +275,7 @@ void cb_saveposition ( void ) { | |||
275 | 275 | ||
276 | rb->splash ( 0 , "Saving position" ); | 276 | rb->splash ( 0 , "Saving position" ); |
277 | 277 | ||
278 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT); | 278 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT, 0666); |
279 | 279 | ||
280 | computer++; rb->write(fd, &(computer), sizeof(computer)); computer--; | 280 | computer++; rb->write(fd, &(computer), sizeof(computer)); computer--; |
281 | opponent++; rb->write(fd, &(opponent), sizeof(opponent)); opponent--; | 281 | opponent++; rb->write(fd, &(opponent), sizeof(opponent)); opponent--; |
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index a165e3ee8c..3d699a7c9e 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c | |||
@@ -670,7 +670,7 @@ void pgn_parse_game(const char* filename, | |||
670 | rb->read_line(fhandler, line_buffer, sizeof line_buffer); | 670 | rb->read_line(fhandler, line_buffer, sizeof line_buffer); |
671 | } | 671 | } |
672 | 672 | ||
673 | loghandler = rb->open(LOG_FILE, O_WRONLY | O_CREAT); | 673 | loghandler = rb->open(LOG_FILE, O_WRONLY | O_CREAT, 0666); |
674 | 674 | ||
675 | GNUChess_Initialize(); | 675 | GNUChess_Initialize(); |
676 | 676 | ||
@@ -829,7 +829,7 @@ void pgn_store_game(struct pgn_game_node* game){ | |||
829 | ply_count++; | 829 | ply_count++; |
830 | } | 830 | } |
831 | 831 | ||
832 | fhandler = rb->open(PGN_FILE, O_WRONLY|O_CREAT|O_APPEND); | 832 | fhandler = rb->open(PGN_FILE, O_WRONLY|O_CREAT|O_APPEND, 0666); |
833 | 833 | ||
834 | 834 | ||
835 | /* the first 7 tags are mandatory according to the PGN specification so we | 835 | /* the first 7 tags are mandatory according to the PGN specification so we |
diff --git a/apps/plugins/crypt_firmware.c b/apps/plugins/crypt_firmware.c index 36689b7e8c..051a3d1bd9 100644 --- a/apps/plugins/crypt_firmware.c +++ b/apps/plugins/crypt_firmware.c | |||
@@ -246,7 +246,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
246 | memcpy(buf + 1, "nn2x", 4); | 246 | memcpy(buf + 1, "nn2x", 4); |
247 | 247 | ||
248 | /* 4 - Write to disk */ | 248 | /* 4 - Write to disk */ |
249 | fd = rb->open(outputfilename,O_WRONLY|O_CREAT|O_TRUNC); | 249 | fd = rb->open(outputfilename,O_WRONLY|O_CREAT|O_TRUNC, 0666); |
250 | 250 | ||
251 | if (fd < 0) { | 251 | if (fd < 0) { |
252 | rb->splash(HZ*2, "Could not open output file"); | 252 | rb->splash(HZ*2, "Could not open output file"); |
@@ -307,7 +307,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
307 | memcpy(buf + 1, "nn2g", 4); | 307 | memcpy(buf + 1, "nn2g", 4); |
308 | 308 | ||
309 | /* 4 - Write to disk */ | 309 | /* 4 - Write to disk */ |
310 | fd = rb->open(outputfilename,O_WRONLY|O_CREAT|O_TRUNC); | 310 | fd = rb->open(outputfilename,O_WRONLY|O_CREAT|O_TRUNC, 0666); |
311 | 311 | ||
312 | if (fd < 0) { | 312 | if (fd < 0) { |
313 | rb->splash(HZ*2, "Could not open output file"); | 313 | rb->splash(HZ*2, "Could not open output file"); |
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c index 21efbc4147..1383a2b520 100644 --- a/apps/plugins/doom/rockdoom.c +++ b/apps/plugins/doom/rockdoom.c | |||
@@ -63,13 +63,20 @@ int fileexists(const char * fname) | |||
63 | } | 63 | } |
64 | 64 | ||
65 | #ifndef SIMULATOR | 65 | #ifndef SIMULATOR |
66 | int my_open(const char *file, int flags) | 66 | int my_open(const char *file, int flags, ...) |
67 | { | 67 | { |
68 | if(fpoint==8) | 68 | if(fpoint==8) |
69 | return -1; | 69 | return -1; |
70 | #undef open | 70 | #undef open |
71 | filearray[fpoint]=rb->open(file, flags); | 71 | if (flags & O_CREAT) |
72 | 72 | { | |
73 | va_list ap; | ||
74 | va_start(ap, flags); | ||
75 | filearray[fpoint]=rb->open(file, flags, va_arg(ap, mode_t)); | ||
76 | va_end(ap); | ||
77 | } | ||
78 | else | ||
79 | filearray[fpoint]=rb->open(file, flags); | ||
73 | if(filearray[fpoint]<0) | 80 | if(filearray[fpoint]<0) |
74 | return filearray[fpoint]; | 81 | return filearray[fpoint]; |
75 | 82 | ||
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h index 98f908dc1d..e066fe861c 100644 --- a/apps/plugins/doom/rockmacros.h +++ b/apps/plugins/doom/rockmacros.h | |||
@@ -39,12 +39,12 @@ char *my_strtok( char * s, const char * delim ); | |||
39 | #define read_line(a,b,c) rb->read_line((a),(b),(c)) | 39 | #define read_line(a,b,c) rb->read_line((a),(b),(c)) |
40 | 40 | ||
41 | #ifdef SIMULATOR | 41 | #ifdef SIMULATOR |
42 | #define open(a,b) rb->open((a),(b)) | 42 | #define open(a, ...) rb->open((a), __VA_ARGS__) |
43 | #define close(a) rb->close((a)) | 43 | #define close(a) rb->close((a)) |
44 | #else | 44 | #else |
45 | int my_open(const char *file, int flags); | 45 | int my_open(const char *file, int flags, ...); |
46 | int my_close(int id); | 46 | int my_close(int id); |
47 | #define open(a,b) my_open((a),(b)) | 47 | #define open(a, ...) my_open((a), __VA_ARGS__) |
48 | #define close(a) my_close((a)) | 48 | #define close(a) my_close((a)) |
49 | #endif | 49 | #endif |
50 | 50 | ||
diff --git a/apps/plugins/frotz/fastmem.c b/apps/plugins/frotz/fastmem.c index ba0c95f5ce..ce424af1f2 100644 --- a/apps/plugins/frotz/fastmem.c +++ b/apps/plugins/frotz/fastmem.c | |||
@@ -837,7 +837,7 @@ void z_save (void) | |||
837 | 837 | ||
838 | /* Open auxilary file */ | 838 | /* Open auxilary file */ |
839 | 839 | ||
840 | if ((gfp = rb->open (new_name, O_WRONLY|O_CREAT|O_TRUNC)) < 0) | 840 | if ((gfp = rb->open (new_name, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) |
841 | goto finished; | 841 | goto finished; |
842 | 842 | ||
843 | /* Write auxilary file */ | 843 | /* Write auxilary file */ |
@@ -859,7 +859,7 @@ void z_save (void) | |||
859 | 859 | ||
860 | /* Open game file */ | 860 | /* Open game file */ |
861 | 861 | ||
862 | if ((gfp = rb->open (new_name, O_WRONLY|O_CREAT|O_TRUNC)) < 0) | 862 | if ((gfp = rb->open (new_name, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) |
863 | goto finished; | 863 | goto finished; |
864 | 864 | ||
865 | success = save_quetzal (gfp, story_fp); | 865 | success = save_quetzal (gfp, story_fp); |
diff --git a/apps/plugins/frotz/files.c b/apps/plugins/frotz/files.c index 1baaa4073f..7ca916186c 100644 --- a/apps/plugins/frotz/files.c +++ b/apps/plugins/frotz/files.c | |||
@@ -74,7 +74,7 @@ void script_open (void) | |||
74 | 74 | ||
75 | /* Opening in "at" mode doesn't work for script_erase_input... */ | 75 | /* Opening in "at" mode doesn't work for script_erase_input... */ |
76 | 76 | ||
77 | if ((sfp = rb->open (script_name, O_RDWR|O_CREAT)) != -1) { | 77 | if ((sfp = rb->open (script_name, O_RDWR|O_CREAT, 0666)) != -1) { |
78 | 78 | ||
79 | fseek (sfp, 0, SEEK_END); | 79 | fseek (sfp, 0, SEEK_END); |
80 | 80 | ||
@@ -290,7 +290,7 @@ void record_open (void) | |||
290 | 290 | ||
291 | strcpy (command_name, new_name); | 291 | strcpy (command_name, new_name); |
292 | 292 | ||
293 | if ((rfp = rb->open (new_name, O_WRONLY|O_CREAT|O_TRUNC)) != -1) | 293 | if ((rfp = rb->open (new_name, O_WRONLY|O_CREAT|O_TRUNC, 0666)) != -1) |
294 | ostream_record = TRUE; | 294 | ostream_record = TRUE; |
295 | else | 295 | else |
296 | print_string ("Cannot open file\n"); | 296 | print_string ("Cannot open file\n"); |
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index 6bed9bf827..c2340aa557 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c | |||
@@ -498,7 +498,7 @@ static void jewels_savegame(struct game_context* bj) | |||
498 | { | 498 | { |
499 | int fd; | 499 | int fd; |
500 | /* write out the game state to the save file */ | 500 | /* write out the game state to the save file */ |
501 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT); | 501 | fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT, 0666); |
502 | if(fd < 0) return; | 502 | if(fd < 0) return; |
503 | 503 | ||
504 | rb->write(fd, &bj->tmp_type, sizeof(bj->tmp_type)); | 504 | rb->write(fd, &bj->tmp_type, sizeof(bj->tmp_type)); |
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index f8da40f08e..c6b060c7fd 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c | |||
@@ -584,7 +584,7 @@ static int keybox(void) | |||
584 | 584 | ||
585 | if (data_changed) | 585 | if (data_changed) |
586 | { | 586 | { |
587 | fd = rb->open(KEYBOX_FILE, O_WRONLY | O_CREAT | O_TRUNC); | 587 | fd = rb->open(KEYBOX_FILE, O_WRONLY | O_CREAT | O_TRUNC, 0666); |
588 | if (fd < 0) | 588 | if (fd < 0) |
589 | return FILE_OPEN_ERROR; | 589 | return FILE_OPEN_ERROR; |
590 | write_output(fd); | 590 | write_output(fd); |
diff --git a/apps/plugins/lib/highscore.c b/apps/plugins/lib/highscore.c index 9ada06e8fe..185930202a 100644 --- a/apps/plugins/lib/highscore.c +++ b/apps/plugins/lib/highscore.c | |||
@@ -33,7 +33,7 @@ int highscore_save(char *filename, struct highscore *scores, int num_scores) | |||
33 | if(!highscore_updated) | 33 | if(!highscore_updated) |
34 | return 1; | 34 | return 1; |
35 | 35 | ||
36 | fd = rb->open(filename, O_WRONLY|O_CREAT); | 36 | fd = rb->open(filename, O_WRONLY|O_CREAT, 0666); |
37 | if(fd < 0) | 37 | if(fd < 0) |
38 | return -1; | 38 | return -1; |
39 | 39 | ||
diff --git a/apps/plugins/lua/liolib.c b/apps/plugins/lua/liolib.c index e50524ae89..7a43915f20 100644 --- a/apps/plugins/lua/liolib.c +++ b/apps/plugins/lua/liolib.c | |||
@@ -158,7 +158,7 @@ static int io_open (lua_State *L) { | |||
158 | } | 158 | } |
159 | if((*mode == 'w' || *mode == 'a') && !rb->file_exists(filename)) | 159 | if((*mode == 'w' || *mode == 'a') && !rb->file_exists(filename)) |
160 | flags |= O_CREAT; | 160 | flags |= O_CREAT; |
161 | *pf = rb->open(filename, flags); | 161 | *pf = rb->open(filename, flags, 0666); |
162 | return (*pf < 0) ? pushresult(L, 0, filename) : 1; | 162 | return (*pf < 0) ? pushresult(L, 0, filename) : 1; |
163 | } | 163 | } |
164 | 164 | ||
diff --git a/apps/plugins/md5sum.c b/apps/plugins/md5sum.c index 973ffb3237..9dd8f5a8a7 100644 --- a/apps/plugins/md5sum.c +++ b/apps/plugins/md5sum.c | |||
@@ -246,7 +246,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
246 | done = 0; | 246 | done = 0; |
247 | action( out, arg ); | 247 | action( out, arg ); |
248 | 248 | ||
249 | out = rb->open( filename, O_WRONLY|O_CREAT|O_TRUNC ); | 249 | out = rb->open( filename, O_WRONLY|O_CREAT|O_TRUNC , 0666); |
250 | if( out < 0 ) return PLUGIN_ERROR; | 250 | if( out < 0 ) return PLUGIN_ERROR; |
251 | action( out, arg ); | 251 | action( out, arg ); |
252 | rb->close( out ); | 252 | rb->close( out ); |
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index 50aa99b2ae..fe417ce180 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c | |||
@@ -2598,7 +2598,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
2598 | { | 2598 | { |
2599 | init_mp3_encoder_engine(true, brate[srat], cfg.samplerate); | 2599 | init_mp3_encoder_engine(true, brate[srat], cfg.samplerate); |
2600 | get_mp3_filename(wav_filename); | 2600 | get_mp3_filename(wav_filename); |
2601 | mp3file = rb->open(mp3_name , O_WRONLY|O_CREAT|O_TRUNC); | 2601 | mp3file = rb->open(mp3_name , O_WRONLY|O_CREAT|O_TRUNC, 0666); |
2602 | frames = 0; | 2602 | frames = 0; |
2603 | 2603 | ||
2604 | tim = *rb->current_tick; | 2604 | tim = *rb->current_tick; |
diff --git a/apps/plugins/pdbox/PDa/intern/sfwrite~.c b/apps/plugins/pdbox/PDa/intern/sfwrite~.c index ba63322380..49df0b7eeb 100644 --- a/apps/plugins/pdbox/PDa/intern/sfwrite~.c +++ b/apps/plugins/pdbox/PDa/intern/sfwrite~.c | |||
@@ -91,11 +91,7 @@ static void sfwrite_open(t_sfwrite *x,t_symbol *filename) | |||
91 | 91 | ||
92 | sfwrite_close(x); | 92 | sfwrite_close(x); |
93 | 93 | ||
94 | #ifdef ROCKBOX | ||
95 | if ((x->x_file = open(fname, O_RDWR | O_CREAT)) < 0) | ||
96 | #else | ||
97 | if ((x->x_file = open(fname,O_RDWR | O_CREAT,0664)) < 0) | 94 | if ((x->x_file = open(fname,O_RDWR | O_CREAT,0664)) < 0) |
98 | #endif | ||
99 | { | 95 | { |
100 | error("can't create %s",fname); | 96 | error("can't create %s",fname); |
101 | return; | 97 | return; |
diff --git a/apps/plugins/pdbox/PDa/src/g_array.c b/apps/plugins/pdbox/PDa/src/g_array.c index 431cfeb31d..f0359e465a 100644 --- a/apps/plugins/pdbox/PDa/src/g_array.c +++ b/apps/plugins/pdbox/PDa/src/g_array.c | |||
@@ -1306,7 +1306,7 @@ static void garray_write(t_garray *x, t_symbol *filename) | |||
1306 | buf, MAXPDSTRING); | 1306 | buf, MAXPDSTRING); |
1307 | sys_bashfilename(buf, buf); | 1307 | sys_bashfilename(buf, buf); |
1308 | #ifdef ROCKBOX | 1308 | #ifdef ROCKBOX |
1309 | if(!(fd = open(buf, O_WRONLY|O_CREAT|O_TRUNC))) | 1309 | if(!(fd = open(buf, O_WRONLY|O_CREAT|O_TRUNC, 0666))) |
1310 | #else | 1310 | #else |
1311 | if (!(fd = fopen(buf, "w"))) | 1311 | if (!(fd = fopen(buf, "w"))) |
1312 | #endif | 1312 | #endif |
@@ -1388,7 +1388,7 @@ static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format) | |||
1388 | buf2, MAXPDSTRING); | 1388 | buf2, MAXPDSTRING); |
1389 | sys_bashfilename(buf2, buf2); | 1389 | sys_bashfilename(buf2, buf2); |
1390 | #ifdef ROCKBOX | 1390 | #ifdef ROCKBOX |
1391 | if(!(fd = open(buf2, O_WRONLY|O_CREAT|O_TRUNC))) | 1391 | if(!(fd = open(buf2, O_WRONLY|O_CREAT|O_TRUNC, 0666))) |
1392 | #else | 1392 | #else |
1393 | if (!(fd = fopen(buf2, BINWRITEMODE))) | 1393 | if (!(fd = fopen(buf2, BINWRITEMODE))) |
1394 | #endif | 1394 | #endif |
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 6a62fee8ff..d5e7a10cdc 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c | |||
@@ -214,7 +214,7 @@ void generate(void) | |||
214 | { | 214 | { |
215 | dirs_count = 0; | 215 | dirs_count = 0; |
216 | abort = false; | 216 | abort = false; |
217 | fd = rb->open(RFA_FILE,O_CREAT|O_WRONLY); | 217 | fd = rb->open(RFA_FILE,O_CREAT|O_WRONLY, 0666); |
218 | rb->write(fd,&dirs_count,sizeof(int)); | 218 | rb->write(fd,&dirs_count,sizeof(int)); |
219 | if (fd < 0) | 219 | if (fd < 0) |
220 | { | 220 | { |
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index f1ad8399fb..4e261e4547 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c | |||
@@ -877,7 +877,7 @@ static void dump_resume(void) | |||
877 | { | 877 | { |
878 | int fd; | 878 | int fd; |
879 | 879 | ||
880 | fd = rb->open(RESUME_FILE, O_WRONLY|O_CREAT); | 880 | fd = rb->open(RESUME_FILE, O_WRONLY|O_CREAT, 0666); |
881 | if (fd < 0) | 881 | if (fd < 0) |
882 | goto fail; | 882 | goto fail; |
883 | 883 | ||
diff --git a/apps/plugins/rockboy/cpu.c b/apps/plugins/rockboy/cpu.c index 2fc7411411..e1d1324c4b 100644 --- a/apps/plugins/rockboy/cpu.c +++ b/apps/plugins/rockboy/cpu.c | |||
@@ -947,7 +947,7 @@ next: | |||
947 | int fd; | 947 | int fd; |
948 | blockcount++; | 948 | blockcount++; |
949 | snprintf(meow,499,"/dyna_0x%x_run.rb",PC); | 949 | snprintf(meow,499,"/dyna_0x%x_run.rb",PC); |
950 | fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC); | 950 | fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC, 0666); |
951 | if(fd>=0) | 951 | if(fd>=0) |
952 | { | 952 | { |
953 | fdprintf(fd,"Block 0x%x Blockcount: %d\n",PC,blockcount); | 953 | fdprintf(fd,"Block 0x%x Blockcount: %d\n",PC,blockcount); |
diff --git a/apps/plugins/rockboy/dynarec.c b/apps/plugins/rockboy/dynarec.c index afe6caaf1a..3c71115654 100644 --- a/apps/plugins/rockboy/dynarec.c +++ b/apps/plugins/rockboy/dynarec.c | |||
@@ -425,7 +425,7 @@ void dynamic_recompile (struct dynarec_block *newblock) | |||
425 | newblock->block=dynapointer; | 425 | newblock->block=dynapointer; |
426 | #ifdef DYNA_DEBUG | 426 | #ifdef DYNA_DEBUG |
427 | snprintf(meow,499,"/dyna_0x%x_asm.rb",PC); | 427 | snprintf(meow,499,"/dyna_0x%x_asm.rb",PC); |
428 | fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC); | 428 | fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC, 0666); |
429 | if(fd<0) | 429 | if(fd<0) |
430 | { | 430 | { |
431 | die("couldn't open dyna debug file"); | 431 | die("couldn't open dyna debug file"); |
@@ -1907,7 +1907,7 @@ void dynamic_recompile (struct dynarec_block *newblock) | |||
1907 | newblock->length=dynapointer-newblock->block; | 1907 | newblock->length=dynapointer-newblock->block; |
1908 | IF_COP(rb->cpucache_invalidate()); | 1908 | IF_COP(rb->cpucache_invalidate()); |
1909 | snprintf(meow,499,"/dyna_0x%x_code.rb",PC); | 1909 | snprintf(meow,499,"/dyna_0x%x_code.rb",PC); |
1910 | fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC); | 1910 | fd=open(meow,O_WRONLY|O_CREAT|O_TRUNC, 0666); |
1911 | if(fd>=0) | 1911 | if(fd>=0) |
1912 | { | 1912 | { |
1913 | write(fd,newblock->block,newblock->length); | 1913 | write(fd,newblock->block,newblock->length); |
diff --git a/apps/plugins/rockboy/loader.c b/apps/plugins/rockboy/loader.c index 71ab4e78d7..e92b7d0a7e 100644 --- a/apps/plugins/rockboy/loader.c +++ b/apps/plugins/rockboy/loader.c | |||
@@ -249,7 +249,7 @@ static int sram_save(void) | |||
249 | /* If we crash before we ever loaded sram, DO NOT SAVE! */ | 249 | /* If we crash before we ever loaded sram, DO NOT SAVE! */ |
250 | if (!mbc.batt || !ram.loaded || !mbc.ramsize) | 250 | if (!mbc.batt || !ram.loaded || !mbc.ramsize) |
251 | return -1; | 251 | return -1; |
252 | fd = open(sramfile, O_WRONLY|O_CREAT|O_TRUNC); | 252 | fd = open(sramfile, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
253 | if (fd<0) return -1; | 253 | if (fd<0) return -1; |
254 | snprintf(meow,499,"Saving savedata to %s",sramfile); | 254 | snprintf(meow,499,"Saving savedata to %s",sramfile); |
255 | rb->splash(HZ*2, meow); | 255 | rb->splash(HZ*2, meow); |
@@ -263,7 +263,7 @@ static void rtc_save(void) | |||
263 | { | 263 | { |
264 | int fd; | 264 | int fd; |
265 | if (!rtc.batt) return; | 265 | if (!rtc.batt) return; |
266 | if ((fd = open(rtcfile, O_WRONLY|O_CREAT|O_TRUNC))<0) return; | 266 | if ((fd = open(rtcfile, O_WRONLY|O_CREAT|O_TRUNC, 0666))<0) return; |
267 | rtc_save_internal(fd); | 267 | rtc_save_internal(fd); |
268 | close(fd); | 268 | close(fd); |
269 | } | 269 | } |
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c index 710a47646a..2f6c3102ff 100644 --- a/apps/plugins/rockboy/menu.c +++ b/apps/plugins/rockboy/menu.c | |||
@@ -178,7 +178,7 @@ static bool do_file(char *path, char *desc, bool is_load) { | |||
178 | file_mode = is_load ? O_RDONLY : (O_WRONLY | O_CREAT); | 178 | file_mode = is_load ? O_RDONLY : (O_WRONLY | O_CREAT); |
179 | 179 | ||
180 | /* attempt to open file descriptor here */ | 180 | /* attempt to open file descriptor here */ |
181 | if ((fd = open(path, file_mode)) < 0) | 181 | if ((fd = open(path, file_mode, 0666)) < 0) |
182 | return false; | 182 | return false; |
183 | 183 | ||
184 | /* load/save state */ | 184 | /* load/save state */ |
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index ba60b14f72..ec224a20db 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c | |||
@@ -325,7 +325,7 @@ static void savesettings(void) | |||
325 | { | 325 | { |
326 | options.dirty=0; | 326 | options.dirty=0; |
327 | snprintf(optionsave, sizeof(optionsave), "%s/%s", savedir, optionname); | 327 | snprintf(optionsave, sizeof(optionsave), "%s/%s", savedir, optionname); |
328 | fd = open(optionsave, O_WRONLY|O_CREAT|O_TRUNC); | 328 | fd = open(optionsave, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
329 | write(fd,&options, sizeof(options)); | 329 | write(fd,&options, sizeof(options)); |
330 | close(fd); | 330 | close(fd); |
331 | } | 331 | } |
diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h index 0fd13f6ef9..e7f79a53d3 100644 --- a/apps/plugins/rockboy/rockmacros.h +++ b/apps/plugins/rockboy/rockmacros.h | |||
@@ -59,7 +59,9 @@ void dynamic_recompile (struct dynarec_block *newblock); | |||
59 | #define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z'))) | 59 | #define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z'))) |
60 | #define isalnum(c) (isdigit(c) || (isalpha(c))) | 60 | #define isalnum(c) (isdigit(c) || (isalpha(c))) |
61 | 61 | ||
62 | #define open(a,b) rb->open((a),(b)) | 62 | /* only 1 fixed argument for open, since variadic macros don't except empty |
63 | * variable parameters */ | ||
64 | #define open(a, ...) rb->open((a), __VA_ARGS__) | ||
63 | #define lseek(a,b,c) rb->lseek((a),(b),(c)) | 65 | #define lseek(a,b,c) rb->lseek((a),(b),(c)) |
64 | #define close(a) rb->close((a)) | 66 | #define close(a) rb->close((a)) |
65 | #define read(a,b,c) rb->read((a),(b),(c)) | 67 | #define read(a,b,c) rb->read((a),(b),(c)) |
diff --git a/apps/plugins/search.c b/apps/plugins/search.c index 4f60c82d08..ba16b8821b 100644 --- a/apps/plugins/search.c +++ b/apps/plugins/search.c | |||
@@ -123,7 +123,7 @@ static bool search_init(const char* file){ | |||
123 | if (bomsize) | 123 | if (bomsize) |
124 | fdw = rb->open_utf8(resultfile, O_WRONLY|O_CREAT|O_TRUNC); | 124 | fdw = rb->open_utf8(resultfile, O_WRONLY|O_CREAT|O_TRUNC); |
125 | else | 125 | else |
126 | fdw = rb->open(resultfile, O_WRONLY|O_CREAT|O_TRUNC); | 126 | fdw = rb->open(resultfile, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
127 | 127 | ||
128 | if (fdw < 0) { | 128 | if (fdw < 0) { |
129 | #ifdef HAVE_LCD_BITMAP | 129 | #ifdef HAVE_LCD_BITMAP |
diff --git a/apps/plugins/searchengine/searchengine.c b/apps/plugins/searchengine/searchengine.c index ddcd0ead0d..f737a27621 100644 --- a/apps/plugins/searchengine/searchengine.c +++ b/apps/plugins/searchengine/searchengine.c | |||
@@ -78,7 +78,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
78 | rb->close(parsefd); | 78 | rb->close(parsefd); |
79 | hits=0; | 79 | hits=0; |
80 | if(result!=0) { | 80 | if(result!=0) { |
81 | int fd=rb->open("/search.m3u", O_WRONLY|O_CREAT|O_TRUNC); | 81 | int fd=rb->open("/search.m3u", O_WRONLY|O_CREAT|O_TRUNC, 0666); |
82 | int i; | 82 | int i; |
83 | for(i=0;i<rb->tagdbheader->filecount;i++) | 83 | for(i=0;i<rb->tagdbheader->filecount;i++) |
84 | if(result[i]) { | 84 | if(result[i]) { |
diff --git a/apps/plugins/settings_dumper.c b/apps/plugins/settings_dumper.c index 68c2433ce6..ea69353e17 100644 --- a/apps/plugins/settings_dumper.c +++ b/apps/plugins/settings_dumper.c | |||
@@ -124,7 +124,7 @@ enum plugin_status plugin_start( | |||
124 | int fd; | 124 | int fd; |
125 | (void)parameter; | 125 | (void)parameter; |
126 | 126 | ||
127 | fd = rb->open(FILENAME, O_CREAT|O_TRUNC|O_WRONLY); | 127 | fd = rb->open(FILENAME, O_CREAT|O_TRUNC|O_WRONLY, 0666); |
128 | if (fd < 0) | 128 | if (fd < 0) |
129 | return PLUGIN_ERROR; | 129 | return PLUGIN_ERROR; |
130 | list = rb->get_settings_list(&setting_count); | 130 | list = rb->get_settings_list(&setting_count); |
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 838b4de5b0..3a853c81aa 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c | |||
@@ -1117,7 +1117,7 @@ static bool save(char *filename, bool solution) | |||
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | if (filename[0] == '\0' || | 1119 | if (filename[0] == '\0' || |
1120 | (fd = rb->open(filename, O_WRONLY|O_CREAT|O_TRUNC)) < 0) { | 1120 | (fd = rb->open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { |
1121 | rb->splashf(HZ*2, "Unable to open %s", filename); | 1121 | rb->splashf(HZ*2, "Unable to open %s", filename); |
1122 | return false; | 1122 | return false; |
1123 | } | 1123 | } |
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index cf4e6475b0..1c7aefb1c3 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c | |||
@@ -1272,7 +1272,7 @@ int open_save_file( int flags ) | |||
1272 | { | 1272 | { |
1273 | char buf[MAX_PATH]; | 1273 | char buf[MAX_PATH]; |
1274 | get_save_filename( buf ); | 1274 | get_save_filename( buf ); |
1275 | return rb->open( buf, flags ); | 1275 | return rb->open( buf, flags, 0666); |
1276 | } | 1276 | } |
1277 | 1277 | ||
1278 | void delete_save_file( void ) | 1278 | void delete_save_file( void ) |
diff --git a/apps/plugins/sort.c b/apps/plugins/sort.c index 2ae788ebbd..05c45cce1e 100644 --- a/apps/plugins/sort.c +++ b/apps/plugins/sort.c | |||
@@ -147,7 +147,7 @@ static int write_file(void) | |||
147 | if (bomsize) | 147 | if (bomsize) |
148 | fd = rb->open_utf8(tmpfilename, O_WRONLY|O_CREAT|O_TRUNC); | 148 | fd = rb->open_utf8(tmpfilename, O_WRONLY|O_CREAT|O_TRUNC); |
149 | else | 149 | else |
150 | fd = rb->open(tmpfilename, O_WRONLY|O_CREAT|O_TRUNC); | 150 | fd = rb->open(tmpfilename, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
151 | 151 | ||
152 | if(fd < 0) | 152 | if(fd < 0) |
153 | return 10 * fd - 1; | 153 | return 10 * fd - 1; |
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c index a07769c390..3e5161b67f 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c | |||
@@ -687,7 +687,7 @@ static int save( | |||
687 | /* write the file 1 */ | 687 | /* write the file 1 */ |
688 | if (file_name1 != NULL) | 688 | if (file_name1 != NULL) |
689 | { | 689 | { |
690 | file1 = rb->open (file_name1, O_WRONLY | O_CREAT); | 690 | file1 = rb->open (file_name1, O_WRONLY | O_CREAT, 0666); |
691 | if (file1 >= 0) | 691 | if (file1 >= 0) |
692 | { | 692 | { |
693 | int rc = copy_file(file1, src_file, end, y*2 + 1, y -1); | 693 | int rc = copy_file(file1, src_file, end, y*2 + 1, y -1); |
@@ -727,7 +727,7 @@ static int save( | |||
727 | if (file_name2 != NULL) | 727 | if (file_name2 != NULL) |
728 | { | 728 | { |
729 | /* write file 2 */ | 729 | /* write file 2 */ |
730 | file2 = rb->open (file_name2, O_WRONLY | O_CREAT); | 730 | file2 = rb->open (file_name2, O_WRONLY | O_CREAT, 0666); |
731 | if (file2 >= 0) | 731 | if (file2 >= 0) |
732 | { | 732 | { |
733 | end = mp3->filesize - end; | 733 | end = mp3->filesize - end; |
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c index cb85e360db..b09dcdb030 100644 --- a/apps/plugins/stopwatch.c +++ b/apps/plugins/stopwatch.c | |||
@@ -358,7 +358,7 @@ void save_stopwatch(void) | |||
358 | { | 358 | { |
359 | int fd; | 359 | int fd; |
360 | 360 | ||
361 | fd = rb->open(STOPWATCH_FILE, O_CREAT|O_WRONLY|O_TRUNC); | 361 | fd = rb->open(STOPWATCH_FILE, O_CREAT|O_WRONLY|O_TRUNC, 0666); |
362 | 362 | ||
363 | if (fd < 0) | 363 | if (fd < 0) |
364 | { | 364 | { |
diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index 9e7e969eee..4a7fbd93a8 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c | |||
@@ -808,7 +808,7 @@ bool save_sudoku(struct sudoku_state_t* state) | |||
808 | return false; | 808 | return false; |
809 | } | 809 | } |
810 | 810 | ||
811 | fd=rb->open(state->filename, O_WRONLY|O_CREAT); | 811 | fd=rb->open(state->filename, O_WRONLY|O_CREAT, 0666); |
812 | if (fd >= 0) { | 812 | if (fd >= 0) { |
813 | for (r=0;r<9;r++) { | 813 | for (r=0;r<9;r++) { |
814 | i=0; | 814 | i=0; |
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c index d26e98803e..d5d08fb162 100644 --- a/apps/plugins/superdom.c +++ b/apps/plugins/superdom.c | |||
@@ -626,7 +626,7 @@ int save_game(void) { | |||
626 | return -1; | 626 | return -1; |
627 | } | 627 | } |
628 | 628 | ||
629 | fd = rb->open(savepath, O_WRONLY|O_CREAT); | 629 | fd = rb->open(savepath, O_WRONLY|O_CREAT, 0666); |
630 | DEBUGF("savepath: %s\n", savepath); | 630 | DEBUGF("savepath: %s\n", savepath); |
631 | if(fd < 0) { | 631 | if(fd < 0) { |
632 | DEBUGF("Couldn't create/open file\n"); | 632 | DEBUGF("Couldn't create/open file\n"); |
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index f3b826e04e..1ecf225529 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c | |||
@@ -59,7 +59,7 @@ static bool log_init(bool use_logfile) | |||
59 | if (use_logfile) { | 59 | if (use_logfile) { |
60 | rb->create_numbered_filename(logfilename, "/", "test_codec_log_", ".txt", | 60 | rb->create_numbered_filename(logfilename, "/", "test_codec_log_", ".txt", |
61 | 2 IF_CNFN_NUM_(, NULL)); | 61 | 2 IF_CNFN_NUM_(, NULL)); |
62 | log_fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC); | 62 | log_fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC, 0666); |
63 | return log_fd >= 0; | 63 | return log_fd >= 0; |
64 | } | 64 | } |
65 | 65 | ||
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c index 396e03c818..c83fb7e1d2 100644 --- a/apps/plugins/test_disk.c +++ b/apps/plugins/test_disk.c | |||
@@ -85,7 +85,7 @@ static bool log_init(void) | |||
85 | 85 | ||
86 | rb->create_numbered_filename(logfilename, "/", "test_disk_log_", ".txt", | 86 | rb->create_numbered_filename(logfilename, "/", "test_disk_log_", ".txt", |
87 | 2 IF_CNFN_NUM_(, NULL)); | 87 | 2 IF_CNFN_NUM_(, NULL)); |
88 | log_fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC); | 88 | log_fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC, 0666); |
89 | return log_fd >= 0; | 89 | return log_fd >= 0; |
90 | } | 90 | } |
91 | 91 | ||
diff --git a/apps/plugins/test_gfx.c b/apps/plugins/test_gfx.c index 728eb5600e..0a2e02e43f 100644 --- a/apps/plugins/test_gfx.c +++ b/apps/plugins/test_gfx.c | |||
@@ -47,7 +47,7 @@ static int log_init(void) | |||
47 | 47 | ||
48 | rb->create_numbered_filename(logfilename, "/", "test_gfx_log_", ".txt", | 48 | rb->create_numbered_filename(logfilename, "/", "test_gfx_log_", ".txt", |
49 | 2 IF_CNFN_NUM_(, NULL)); | 49 | 2 IF_CNFN_NUM_(, NULL)); |
50 | fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC); | 50 | fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC, 0666); |
51 | return fd; | 51 | return fd; |
52 | } | 52 | } |
53 | 53 | ||
diff --git a/apps/plugins/test_grey.c b/apps/plugins/test_grey.c index c2adaf06b5..be28bedfb3 100644 --- a/apps/plugins/test_grey.c +++ b/apps/plugins/test_grey.c | |||
@@ -237,7 +237,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
237 | case GREY_OK: | 237 | case GREY_OK: |
238 | rb->create_numbered_filename(filename, "/", "test_grey_", | 238 | rb->create_numbered_filename(filename, "/", "test_grey_", |
239 | ".txt", 2 IF_CNFN_NUM_(, NULL)); | 239 | ".txt", 2 IF_CNFN_NUM_(, NULL)); |
240 | fd = rb->open(filename, O_RDWR|O_CREAT|O_TRUNC); | 240 | fd = rb->open(filename, O_RDWR|O_CREAT|O_TRUNC, 0666); |
241 | if (fd >= 0) | 241 | if (fd >= 0) |
242 | { | 242 | { |
243 | for (i = 0; i <= STEPS; i++) | 243 | for (i = 0; i <= STEPS; i++) |
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index 4d5812ba2c..e54935265c 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c | |||
@@ -180,7 +180,7 @@ bool save_changes(int overwrite) | |||
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | fd = rb->open(filename,O_WRONLY|O_CREAT|O_TRUNC); | 183 | fd = rb->open(filename,O_WRONLY|O_CREAT|O_TRUNC, 0666); |
184 | if (fd < 0) | 184 | if (fd < 0) |
185 | { | 185 | { |
186 | newfile = true; | 186 | newfile = true; |
diff --git a/apps/plugins/theme_remove.c b/apps/plugins/theme_remove.c index 3bb41929f3..f818ac4afe 100644 --- a/apps/plugins/theme_remove.c +++ b/apps/plugins/theme_remove.c | |||
@@ -686,7 +686,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
686 | case 0: | 686 | case 0: |
687 | if(create_log) | 687 | if(create_log) |
688 | { | 688 | { |
689 | log_fd = rb->open(LOG_FILENAME, O_WRONLY|O_CREAT|O_APPEND); | 689 | log_fd = rb->open(LOG_FILENAME, O_WRONLY|O_CREAT|O_APPEND, 0666); |
690 | if(log_fd >= 0) | 690 | if(log_fd >= 0) |
691 | rb->fdprintf(log_fd, "---- %s ----\n", title); | 691 | rb->fdprintf(log_fd, "---- %s ----\n", title); |
692 | else | 692 | else |
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index ed84d26f28..ffed414f68 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c | |||
@@ -2138,7 +2138,7 @@ static bool viewer_load_global_settings(void) | |||
2138 | 2138 | ||
2139 | static bool viewer_save_global_settings(void) | 2139 | static bool viewer_save_global_settings(void) |
2140 | { | 2140 | { |
2141 | int sfd = rb->open(GLOBAL_SETTINGS_TMP_FILE, O_WRONLY|O_CREAT|O_TRUNC); | 2141 | int sfd = rb->open(GLOBAL_SETTINGS_TMP_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
2142 | unsigned char buf[GLOBAL_SETTINGS_H_SIZE]; | 2142 | unsigned char buf[GLOBAL_SETTINGS_H_SIZE]; |
2143 | 2143 | ||
2144 | if (sfd < 0) | 2144 | if (sfd < 0) |
@@ -2219,7 +2219,7 @@ static bool viewer_convert_settings_file(void) | |||
2219 | if ((sfd = rb->open(SETTINGS_FILE, O_RDONLY)) < 0) | 2219 | if ((sfd = rb->open(SETTINGS_FILE, O_RDONLY)) < 0) |
2220 | return false; | 2220 | return false; |
2221 | 2221 | ||
2222 | if ((tfd = rb->open(SETTINGS_TMP_FILE, O_WRONLY|O_CREAT|O_TRUNC)) < 0) | 2222 | if ((tfd = rb->open(SETTINGS_TMP_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) |
2223 | { | 2223 | { |
2224 | rb->close(sfd); | 2224 | rb->close(sfd); |
2225 | return false; | 2225 | return false; |
@@ -2441,7 +2441,7 @@ static bool viewer_save_settings(void) | |||
2441 | bookmarks[bookmark_count-1].flag = BOOKMARK_LAST; | 2441 | bookmarks[bookmark_count-1].flag = BOOKMARK_LAST; |
2442 | } | 2442 | } |
2443 | 2443 | ||
2444 | tfd = rb->open(SETTINGS_TMP_FILE, O_WRONLY|O_CREAT|O_TRUNC); | 2444 | tfd = rb->open(SETTINGS_TMP_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
2445 | if (tfd < 0) | 2445 | if (tfd < 0) |
2446 | return false; | 2446 | return false; |
2447 | 2447 | ||
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c index 732a7b7645..a8aab92113 100644 --- a/apps/plugins/wavrecord.c +++ b/apps/plugins/wavrecord.c | |||
@@ -3492,7 +3492,7 @@ static int record_file(char *filename) | |||
3492 | {8, 32000}, {9, 44100}, {10, 48000} | 3492 | {8, 32000}, {9, 44100}, {10, 48000} |
3493 | }; | 3493 | }; |
3494 | 3494 | ||
3495 | fd = rb->open(filename, O_RDWR|O_CREAT|O_TRUNC); | 3495 | fd = rb->open(filename, O_RDWR|O_CREAT|O_TRUNC, 0666); |
3496 | if (fd < 0) | 3496 | if (fd < 0) |
3497 | { | 3497 | { |
3498 | rb->splash(2*HZ, "Couldn't create WAV file"); | 3498 | rb->splash(2*HZ, "Couldn't create WAV file"); |
diff --git a/apps/plugins/zxbox/spsound.c b/apps/plugins/zxbox/spsound.c index aae4ad9c8d..6a550e2033 100644 --- a/apps/plugins/zxbox/spsound.c +++ b/apps/plugins/zxbox/spsound.c | |||
@@ -223,12 +223,12 @@ void write_buf(void){ | |||
223 | 223 | ||
224 | #if 0 | 224 | #if 0 |
225 | /* can use to save and later analyze what we produce */ | 225 | /* can use to save and later analyze what we produce */ |
226 | i = rb->open ( "/sound.raw" , O_WRONLY | O_APPEND | O_CREAT ); | 226 | i = rb->open ( "/sound.raw" , O_WRONLY | O_APPEND | O_CREAT, 0666); |
227 | rb->write ( i , sp_sound_buf , TMNUM ); | 227 | rb->write ( i , sp_sound_buf , TMNUM ); |
228 | rb->close (i); | 228 | rb->close (i); |
229 | 229 | ||
230 | 230 | ||
231 | i = rb->open ( "/sound2.raw" , O_WRONLY | O_APPEND |O_CREAT); | 231 | i = rb->open ( "/sound2.raw" , O_WRONLY | O_APPEND |O_CREAT, 0666); |
232 | rb->write ( i , (unsigned char *)my_buf , TMNUM*4*3 ); | 232 | rb->write ( i , (unsigned char *)my_buf , TMNUM*4*3 ); |
233 | rb->close (i); | 233 | rb->close (i); |
234 | #endif | 234 | #endif |