118 |
|
char helper_path[MAX_PATH_LENGTH]; |
119 |
|
make_helper_path(path, helper_path, add); |
120 |
|
|
121 |
< |
if ((flag & O_RDWR) || (flag && O_WRONLY)) |
121 |
> |
if ((flag & O_ACCMODE) == O_RDWR || (flag & O_ACCMODE) == O_WRONLY) |
122 |
|
flag |= O_CREAT; |
123 |
|
int fd = open(helper_path, flag, 0666); |
124 |
|
if (fd < 0) { |
365 |
|
} |
366 |
|
|
367 |
|
|
368 |
+ |
/* |
369 |
+ |
* Remove file/directory (and associated helper files), |
370 |
+ |
* returns false on error (and sets errno) |
371 |
+ |
*/ |
372 |
+ |
|
373 |
+ |
bool extfs_remove(const char *path) |
374 |
+ |
{ |
375 |
+ |
// Remove helpers first, don't complain if this fails |
376 |
+ |
char helper_path[MAX_PATH_LENGTH]; |
377 |
+ |
make_helper_path(path, helper_path, ".finf/", false); |
378 |
+ |
remove(helper_path); |
379 |
+ |
make_helper_path(path, helper_path, ".rsrc/", false); |
380 |
+ |
remove(helper_path); |
381 |
+ |
|
382 |
+ |
// Now remove file or directory |
383 |
+ |
if (remove(path) < 0) { |
384 |
+ |
if (errno == EISDIR) |
385 |
+ |
return rmdir(path) == 0; |
386 |
+ |
else |
387 |
+ |
return false; |
388 |
+ |
} |
389 |
+ |
return true; |
390 |
+ |
} |
391 |
+ |
|
392 |
+ |
|
393 |
|
/* |
394 |
|
* ftruncate() is missing from libnix |
395 |
|
*/ |