diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-01-27 21:09:25 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-01-27 21:09:25 +0000 |
commit | 771011a6fc935dd8fa30641971678d7e38821f2a (patch) | |
tree | 76f5eeb952ac8cb6b31572955720e0bfd20fdf58 /firmware/common | |
parent | b703d251be071d0d1bbb7abe458cc0bd215052e0 (diff) | |
download | rockbox-771011a6fc935dd8fa30641971678d7e38821f2a.tar.gz rockbox-771011a6fc935dd8fa30641971678d7e38821f2a.zip |
RaaA: Fix database duplication issue on every start
The code in tagcache.c:commit() was unable to delete
the to-be-commited database file as it read from
$(HOME)/.config/rockbox.org and tried to delete
the file later on in /.rockbox/.
As we didn't specify any flags like IS_FILE or NEED_WRITE
in _get_user_file_path() (which is called by f.e. app_remove()),
it searched for the file in two places.
In case of app_rename() IS_FILE would be wrong, so we just
add a NEED_WRITE to any write operation.
Author: Thomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29148 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common')
-rw-r--r-- | firmware/common/rbpaths.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/firmware/common/rbpaths.c b/firmware/common/rbpaths.c index c82e0f2dce..2d3c1e6603 100644 --- a/firmware/common/rbpaths.c +++ b/firmware/common/rbpaths.c | |||
@@ -160,8 +160,9 @@ int app_remove(const char *name) | |||
160 | const char *fname = name; | 160 | const char *fname = name; |
161 | if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN)) | 161 | if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN)) |
162 | { | 162 | { |
163 | fname = _get_user_file_path(name, 0, realpath, sizeof(realpath)); | 163 | fname = _get_user_file_path(name, NEED_WRITE, realpath, sizeof(realpath)); |
164 | } | 164 | } |
165 | |||
165 | return remove(fname); | 166 | return remove(fname); |
166 | } | 167 | } |
167 | 168 | ||
@@ -171,7 +172,7 @@ int app_rename(const char *old, const char *new) | |||
171 | const char *fname = old; | 172 | const char *fname = old; |
172 | if (!strncmp(ROCKBOX_DIR, old, ROCKBOX_DIR_LEN)) | 173 | if (!strncmp(ROCKBOX_DIR, old, ROCKBOX_DIR_LEN)) |
173 | { | 174 | { |
174 | fname = _get_user_file_path(old, 0, realpath, sizeof(realpath)); | 175 | fname = _get_user_file_path(old, NEED_WRITE, realpath, sizeof(realpath)); |
175 | } | 176 | } |
176 | return rename(fname, new); | 177 | return rename(fname, new); |
177 | } | 178 | } |
@@ -193,7 +194,7 @@ int app_mkdir(const char* name) | |||
193 | const char *fname = name; | 194 | const char *fname = name; |
194 | if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN)) | 195 | if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN)) |
195 | { | 196 | { |
196 | fname = _get_user_file_path(name, 0, realpath, sizeof(realpath)); | 197 | fname = _get_user_file_path(name, NEED_WRITE, realpath, sizeof(realpath)); |
197 | } | 198 | } |
198 | return mkdir(fname); | 199 | return mkdir(fname); |
199 | } | 200 | } |
@@ -204,8 +205,7 @@ int app_rmdir(const char* name) | |||
204 | const char *fname = name; | 205 | const char *fname = name; |
205 | if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN)) | 206 | if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN)) |
206 | { | 207 | { |
207 | fname = _get_user_file_path(name, 0, realpath, sizeof(realpath)); | 208 | fname = _get_user_file_path(name, NEED_WRITE, realpath, sizeof(realpath)); |
208 | } | 209 | } |
209 | return rmdir(fname); | 210 | return rmdir(fname); |
210 | } | 211 | } |
211 | |||