Skip to content
Browse files

mbed: fix rename to work correctly (newname and oldname must have the…

… same fs)

* Fixes rename problem in #597
* Is this a change to the mbed library? Maybe this should go upstream? See #598
  • Loading branch information...
1 parent 7027d19 commit c73a6a410231724f62adb71f915499f45a635e53 @minad minad committed Feb 10, 2015
Showing with 4 additions and 4 deletions.
  1. +4 −4 mbed/src/cpp/stdio.cpp
View
8 mbed/src/cpp/stdio.cpp
@@ -305,11 +305,11 @@ extern "C" int remove(const char *path) {
}
extern "C" int rename(const char *oldname, const char *newname) {
- FilePath fp(oldname);
- FileSystemLike *fs = fp.fileSystem();
- if (fs == NULL) return -1;
+ FilePath a(oldname);
+ FilePath b(newname);
+ if (!a.fileSystem() || a.fileSystem() != b.fileSystem()) return -1;
- return fs->rename(fp.fileName(), newname);
+ return a.fileSystem()->rename(a.fileName(), b.fileName());
}
extern "C" char *tmpnam(char *s) {

0 comments on commit c73a6a4

Please sign in to comment.
Something went wrong with that request. Please try again.