From 32667ecf32746f61fbe834046bebc3f04a690d1f Mon Sep 17 00:00:00 2001 From: robertabcd Date: Wed, 30 Jan 2013 10:04:27 +0000 Subject: 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 --- pttbbs/common/sys/file.c | 4 ++++ 1 file changed, 4 insertions(+) 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 +#include 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; -- cgit v1.2.3