summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-09 01:59:18 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-09 01:59:18 +0300
commitf69bb947dc7be4c44b8d1c86dec3a8b1214a80aa (patch)
tree28fbe2d352a62640e1e2e3efa41847d3a539056f /src/utils
parent95413709e41e1442ad51caa5e33b08ce6adb3887 (diff)
downloadmv-f69bb947dc7be4c44b8d1c86dec3a8b1214a80aa.tar.gz
mv-f69bb947dc7be4c44b8d1c86dec3a8b1214a80aa.tar.bz2
mv-f69bb947dc7be4c44b8d1c86dec3a8b1214a80aa.tar.xz
mv-f69bb947dc7be4c44b8d1c86dec3a8b1214a80aa.zip
add more checks in file renaming function.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/files.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index 15b667ba8..2d7994f8a 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -151,7 +151,8 @@ int Files::renameFile(const std::string &srcName, const std::string &dstName)
delete [] buf;
fclose(srcFile);
fclose(dstFile);
- ::remove(srcName.c_str());
+ if (!::remove(srcName.c_str()))
+ return 0;
- return 0;
+ return -1;
}