summaryrefslogtreecommitdiff
path: root/uisimulator/common/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/common/io.c')
-rw-r--r--uisimulator/common/io.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index 0d680e0e8a..fd30dc68b6 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -147,6 +147,7 @@ extern int _wrmdir(const wchar_t*);
147 147
148 148
149#ifdef HAVE_DIRCACHE 149#ifdef HAVE_DIRCACHE
150void dircache_add_file(const char *name, long startcluster);
150void dircache_remove(const char *name); 151void dircache_remove(const char *name);
151void dircache_rename(const char *oldname, const char *newname); 152void dircache_rename(const char *oldname, const char *newname);
152#endif 153#endif
@@ -389,6 +390,10 @@ int sim_open(const char *name, int o, ...)
389 va_start(ap, o); 390 va_start(ap, o);
390 mode_t mode = va_arg(ap, unsigned int); 391 mode_t mode = va_arg(ap, unsigned int);
391 ret = OPEN(get_sim_pathname(name), opts, mode); 392 ret = OPEN(get_sim_pathname(name), opts, mode);
393#ifdef HAVE_DIRCACHE
394 if (ret >= 0)
395 dircache_add_file(name, 0);
396#endif
392 va_end(ap); 397 va_end(ap);
393 } 398 }
394 else 399 else
@@ -410,7 +415,13 @@ int sim_close(int fd)
410 415
411int sim_creat(const char *name, mode_t mode) 416int sim_creat(const char *name, mode_t mode)
412{ 417{
413 return OPEN(get_sim_pathname(name), O_BINARY | O_WRONLY | O_CREAT | O_TRUNC, mode); 418 int ret = OPEN(get_sim_pathname(name),
419 O_BINARY | O_WRONLY | O_CREAT | O_TRUNC, mode);
420#ifdef HAVE_DIRCACHE
421 if (ret >= 0)
422 dircache_add_file(name, 0);
423#endif
424 return ret;
414} 425}
415 426
416ssize_t sim_read(int fd, void *buf, size_t count) 427ssize_t sim_read(int fd, void *buf, size_t count)
@@ -460,10 +471,12 @@ int sim_rmdir(const char *name)
460 471
461int sim_remove(const char *name) 472int sim_remove(const char *name)
462{ 473{
474 int ret = REMOVE(get_sim_pathname(name));
463#ifdef HAVE_DIRCACHE 475#ifdef HAVE_DIRCACHE
464 dircache_remove(name); 476 if (ret >= 0)
477 dircache_remove(name);
465#endif 478#endif
466 return REMOVE(get_sim_pathname(name)); 479 return ret;
467} 480}
468 481
469int sim_rename(const char *oldname, const char *newname) 482int sim_rename(const char *oldname, const char *newname)