diff options
author | robertabcd <robertabcd@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-01-30 18:04:27 +0800 |
---|---|---|
committer | robertabcd <robertabcd@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-01-30 18:04:27 +0800 |
commit | 32667ecf32746f61fbe834046bebc3f04a690d1f (patch) | |
tree | 07900de717e66e5f0a2b4dc03f9b31c850326838 | |
parent | 59b00a0b1f4224fc50ba5f8a9551f119d22189eb (diff) | |
download | pttbbs-32667ecf32746f61fbe834046bebc3f04a690d1f.tar pttbbs-32667ecf32746f61fbe834046bebc3f04a690d1f.tar.gz pttbbs-32667ecf32746f61fbe834046bebc3f04a690d1f.tar.bz2 pttbbs-32667ecf32746f61fbe834046bebc3f04a690d1f.tar.lz pttbbs-32667ecf32746f61fbe834046bebc3f04a690d1f.tar.xz pttbbs-32667ecf32746f61fbe834046bebc3f04a690d1f.tar.zst pttbbs-32667ecf32746f61fbe834046bebc3f04a690d1f.zip |
Rename should ask /bin/mv for help only when moving across mountpoints.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5783 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/common/sys/file.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pttbbs/common/sys/file.c b/pttbbs/common/sys/file.c index a59c5123..c067779a 100644 --- a/pttbbs/common/sys/file.c +++ b/pttbbs/common/sys/file.c @@ -199,6 +199,7 @@ int copy_file(const char *src, const char *dst) } #include <signal.h> +#include <errno.h> int Rename(const char *src, const char *dst) { @@ -209,6 +210,9 @@ Rename(const char *src, const char *dst) if (rename(src, dst) == 0) return 0; + if (errno != EXDEV) + return -1; + // prevent malicious shell escapes if (strchr(src, ';') || strchr(dst, ';')) return -1; |