summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-06-28 16:01:19 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-06-28 16:01:19 +1000
commite59b50879819db3bbb189ba7e069950a8991ea05 (patch)
tree0c771262fb0f74ef43283c26c71ec8fdb0c5ee3d
parentf9eb2b013510ef35372560e673d0bf80b1b4dd2c (diff)
- (dtucker) [acconfig.h configure.ac sftp-server.c] Bug #823: add sftp
rename handling for Linux which returns EPERM for link() on (at least some) filesystems that do not support hard links. sftp-server will fall back to stat+rename() in such cases.
-rw-r--r--ChangeLog6
-rw-r--r--acconfig.h8
-rw-r--r--configure.ac3
-rw-r--r--sftp-server.c6
4 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e17a5759..ac114505 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
- (tim) update README files.
- (dtucker) [mdoc2man.awk] Bug #883: correctly recognise .Pa and .Ev macros.
- (dtucker) [regress/README.regress] Document new variables.
+ - (dtucker) [acconfig.h configure.ac sftp-server.c] Bug #823: add sftp
+ rename handling for Linux which returns EPERM for link() on (at least some)
+ filesystems that do not support hard links. sftp-server will fall back to
+ stat+rename() in such cases.
20040626
- (djm) OpenBSD CVS Sync
@@ -1438,4 +1442,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
-$Id: ChangeLog,v 1.3455 2004/06/28 05:52:50 dtucker Exp $
+$Id: ChangeLog,v 1.3456 2004/06/28 06:01:19 dtucker Exp $
diff --git a/acconfig.h b/acconfig.h
index f1435351..4c655823 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,4 +1,4 @@
-/* $Id: acconfig.h,v 1.177 2004/04/15 23:22:40 dtucker Exp $ */
+/* $Id: acconfig.h,v 1.178 2004/06/28 06:01:20 dtucker Exp $ */
/*
* Copyright (c) 1999-2003 Damien Miller. All rights reserved.
@@ -434,6 +434,12 @@
/* Define if cmsg_type is not passed correctly */
#undef BROKEN_CMSG_TYPE
+/*
+ * Define to whatever link() returns for "not supported" if it doesn't
+ * return EOPNOTSUPP.
+ */
+#undef LINK_OPNOTSUPP_ERRNO
+
/* Strings used in /etc/passwd to denote locked account */
#undef LOCKED_PASSWD_STRING
#undef LOCKED_PASSWD_PREFIX
diff --git a/configure.ac b/configure.ac
index 1bf3ca66..3f27bf9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-# $Id: configure.ac,v 1.222 2004/06/25 04:03:34 dtucker Exp $
+# $Id: configure.ac,v 1.223 2004/06/28 06:01:20 dtucker Exp $
#
# Copyright (c) 1999-2004 Damien Miller
#
@@ -254,6 +254,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
AC_DEFINE(PAM_TTY_KLUDGE)
AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
+ AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
inet6_default_4in6=yes
case `uname -r` in
1.*|2.0.*)
diff --git a/sftp-server.c b/sftp-server.c
index 39a6bdab..1ff4750e 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -840,7 +840,11 @@ process_rename(void)
else if (S_ISREG(sb.st_mode)) {
/* Race-free rename of regular files */
if (link(oldpath, newpath) == -1) {
- if (errno == EOPNOTSUPP) {
+ if (errno == EOPNOTSUPP
+#ifdef LINK_OPNOTSUPP_ERRNO
+ || errno == LINK_OPNOTSUPP_ERRNO
+#endif
+ ) {
struct stat st;
/*