diff options
Diffstat (limited to 'bootloader/gigabeat-s.c')
-rw-r--r-- | bootloader/gigabeat-s.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/bootloader/gigabeat-s.c b/bootloader/gigabeat-s.c index 3b852dbaa8..499d9c218c 100644 --- a/bootloader/gigabeat-s.c +++ b/bootloader/gigabeat-s.c | |||
@@ -21,13 +21,16 @@ | |||
21 | #include "config.h" | 21 | #include "config.h" |
22 | #include "system.h" | 22 | #include "system.h" |
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <errno.h> | ||
24 | #include "../kernel-internal.h" | 25 | #include "../kernel-internal.h" |
25 | #include "gcc_extensions.h" | 26 | #include "gcc_extensions.h" |
26 | #include "string.h" | 27 | #include "string.h" |
27 | #include "adc.h" | 28 | #include "adc.h" |
28 | #include "powermgmt.h" | 29 | #include "powermgmt.h" |
29 | #include "storage.h" | 30 | #include "storage.h" |
31 | #include "file_internal.h" | ||
30 | #include "dir.h" | 32 | #include "dir.h" |
33 | #include "file.h" | ||
31 | #include "disk.h" | 34 | #include "disk.h" |
32 | #include "common.h" | 35 | #include "common.h" |
33 | #include "rb-loader.h" | 36 | #include "rb-loader.h" |
@@ -219,7 +222,7 @@ static void untar(int tar_fd) | |||
219 | 222 | ||
220 | /* Create the dir */ | 223 | /* Create the dir */ |
221 | ret = mkdir(path); | 224 | ret = mkdir(path); |
222 | if (ret < 0 && ret != -4) | 225 | if (ret < 0 && errno != EEXIST) |
223 | { | 226 | { |
224 | printf("failed to create dir (%d)", ret); | 227 | printf("failed to create dir (%d)", ret); |
225 | } | 228 | } |
@@ -233,14 +236,14 @@ static void handle_untar(void) | |||
233 | char buf[MAX_PATH]; | 236 | char buf[MAX_PATH]; |
234 | char tarstring[6]; | 237 | char tarstring[6]; |
235 | char model[5]; | 238 | char model[5]; |
236 | struct dirent_uncached* entry; | 239 | struct dirent* entry; |
237 | DIR_UNCACHED* dir; | 240 | DIR* dir; |
238 | int fd; | 241 | int fd; |
239 | int rc; | 242 | int rc; |
240 | 243 | ||
241 | dir = opendir_uncached(basedir); | 244 | dir = opendir(basedir); |
242 | 245 | ||
243 | while ((entry = readdir_uncached(dir))) | 246 | while ((entry = readdir(dir))) |
244 | { | 247 | { |
245 | if (*entry->d_name == '.') | 248 | if (*entry->d_name == '.') |
246 | continue; | 249 | continue; |
@@ -262,7 +265,6 @@ static void handle_untar(void) | |||
262 | verbose = true; | 265 | verbose = true; |
263 | printf("Found rockbox binary. Moving..."); | 266 | printf("Found rockbox binary. Moving..."); |
264 | close(fd); | 267 | close(fd); |
265 | remove( BOOTDIR "/" BOOTFILE); | ||
266 | int ret = rename(buf, BOOTDIR "/" BOOTFILE); | 268 | int ret = rename(buf, BOOTDIR "/" BOOTFILE); |
267 | printf("returned %d", ret); | 269 | printf("returned %d", ret); |
268 | sleep(HZ); | 270 | sleep(HZ); |
@@ -365,7 +367,7 @@ void main(void) | |||
365 | if(rc) | 367 | if(rc) |
366 | error(EATA, rc, true); | 368 | error(EATA, rc, true); |
367 | 369 | ||
368 | disk_init(); | 370 | filesystem_init(); |
369 | 371 | ||
370 | rc = disk_mount_all(); | 372 | rc = disk_mount_all(); |
371 | if (rc <= 0) | 373 | if (rc <= 0) |