- (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.
This commit is contained in:
Darren Tucker 2004-06-28 16:01:19 +10:00
parent f9eb2b0135
commit e59b508798
4 changed files with 19 additions and 4 deletions

View File

@ -2,6 +2,10 @@
- (tim) update README files. - (tim) update README files.
- (dtucker) [mdoc2man.awk] Bug #883: correctly recognise .Pa and .Ev macros. - (dtucker) [mdoc2man.awk] Bug #883: correctly recognise .Pa and .Ev macros.
- (dtucker) [regress/README.regress] Document new variables. - (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 20040626
- (djm) OpenBSD CVS Sync - (djm) OpenBSD CVS Sync
@ -1438,4 +1442,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (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 $

View File

@ -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. * Copyright (c) 1999-2003 Damien Miller. All rights reserved.
@ -434,6 +434,12 @@
/* Define if cmsg_type is not passed correctly */ /* Define if cmsg_type is not passed correctly */
#undef BROKEN_CMSG_TYPE #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 */ /* Strings used in /etc/passwd to denote locked account */
#undef LOCKED_PASSWD_STRING #undef LOCKED_PASSWD_STRING
#undef LOCKED_PASSWD_PREFIX #undef LOCKED_PASSWD_PREFIX

View File

@ -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 # Copyright (c) 1999-2004 Damien Miller
# #
@ -254,6 +254,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
AC_DEFINE(PAM_TTY_KLUDGE) AC_DEFINE(PAM_TTY_KLUDGE)
AC_DEFINE(LOCKED_PASSWD_PREFIX, "!") AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
AC_DEFINE(SPT_TYPE,SPT_REUSEARGV) AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
inet6_default_4in6=yes inet6_default_4in6=yes
case `uname -r` in case `uname -r` in
1.*|2.0.*) 1.*|2.0.*)

View File

@ -840,7 +840,11 @@ process_rename(void)
else if (S_ISREG(sb.st_mode)) { else if (S_ISREG(sb.st_mode)) {
/* Race-free rename of regular files */ /* Race-free rename of regular files */
if (link(oldpath, newpath) == -1) { if (link(oldpath, newpath) == -1) {
if (errno == EOPNOTSUPP) { if (errno == EOPNOTSUPP
#ifdef LINK_OPNOTSUPP_ERRNO
|| errno == LINK_OPNOTSUPP_ERRNO
#endif
) {
struct stat st; struct stat st;
/* /*