Skip to content

Commit

Permalink
mbed: fix rename to work correctly (newname and oldname must have the…
Browse files Browse the repository at this point in the history
… 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
minad committed Feb 10, 2015
1 parent 7027d19 commit c73a6a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mbed/src/cpp/stdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c73a6a4

Please sign in to comment.