diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2017-01-18 04:51:56 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2017-01-18 07:45:07 -0500 |
commit | 15e1f592de7d91b208b83425d3c8b12496b30b89 (patch) | |
tree | 12a4e59a0da80dc1a179d8ca77efda1d21070e72 | |
parent | 6103d4d83dba15c5c48e399778668e6f9cb55e86 (diff) | |
download | rockbox-15e1f592de7d91b208b83425d3c8b12496b30b89.tar.gz rockbox-15e1f592de7d91b208b83425d3c8b12496b30b89.zip |
Make consitent internal file API flag behvior, FF_PROBE.
FF_PROBE should leave nothing for caller to clean up whether
testing only the cache or permitting disk access. Less to worry
about.
Change-Id: Iea5aa3c1ae7f9025a9de528b127f08e490154048
-rw-r--r-- | firmware/common/file_internal.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/firmware/common/file_internal.c b/firmware/common/file_internal.c index aa0edb7ebb..75fb21e8a6 100644 --- a/firmware/common/file_internal.c +++ b/firmware/common/file_internal.c | |||
@@ -396,7 +396,8 @@ static int walk_open_info(struct pathwalk *walkp, | |||
396 | else | 396 | else |
397 | callflags &= ~FO_DIRECTORY; | 397 | callflags &= ~FO_DIRECTORY; |
398 | 398 | ||
399 | /* make open official if not simply probing for presence */ | 399 | /* make open official if not simply probing for presence - must do it here |
400 | or compp->info on stack will get destroyed before it was copied */ | ||
400 | if (!(callflags & FF_PROBE)) | 401 | if (!(callflags & FF_PROBE)) |
401 | fileop_onopen_internal(stream, &compp->info, callflags); | 402 | fileop_onopen_internal(stream, &compp->info, callflags); |
402 | 403 | ||
@@ -649,6 +650,10 @@ int open_stream_internal(const char *path, unsigned int callflags, | |||
649 | IF_MV( rc = rootrc; ) | 650 | IF_MV( rc = rootrc; ) |
650 | case WALK_RC_NOT_FOUND: | 651 | case WALK_RC_NOT_FOUND: |
651 | case WALK_RC_FOUND: | 652 | case WALK_RC_FOUND: |
653 | /* FF_PROBE leaves nothing for caller to clean up */ | ||
654 | if (callflags & FF_PROBE) | ||
655 | filestr_base_destroy(stream); | ||
656 | |||
652 | break; | 657 | break; |
653 | 658 | ||
654 | default: /* utter, abject failure :`( */ | 659 | default: /* utter, abject failure :`( */ |
@@ -776,12 +781,7 @@ int test_stream_exists_internal(const char *path, unsigned int callflags) | |||
776 | { | 781 | { |
777 | /* only FF_* flags should be in callflags */ | 782 | /* only FF_* flags should be in callflags */ |
778 | struct filestr_base stream; | 783 | struct filestr_base stream; |
779 | int rc = open_stream_internal(path, callflags | FF_PROBE, &stream, NULL); | 784 | return open_stream_internal(path, callflags | FF_PROBE, &stream, NULL); |
780 | |||
781 | if (rc >= 0) | ||
782 | filestr_base_destroy(&stream); | ||
783 | |||
784 | return rc; | ||
785 | } | 785 | } |
786 | 786 | ||
787 | /* one-time init at startup */ | 787 | /* one-time init at startup */ |