Bug#308561: ssh: sftp rename fails on filesystems that don't support hard links
Hello,
Kenneth C. Arnold, le Wed 11 May 2005 00:55:09 -0400, a écrit :
> status = errno_to_portable(errno);
> else if (S_ISREG(sb.st_mode)) {
> /* Race-free rename of regular files */
> - if (link(oldpath, newpath) == -1)
> - status = errno_to_portable(errno);
> - else if (unlink(oldpath) == -1) {
> + if (link(oldpath, newpath) == -1) {
> + if (errno == EPERM
> +#ifdef LINK_OPNOTSUPP_ERRNO
> + || errno == LINK_OPNOTSUPP_ERRNO
> +#endif
That actually got applied upstream. However, that still doesn't work
with the sshfs filesystem (sic), which returns ENOSYS, fixed by the
attached patch.
Samuel
--- openssh-4.7p1/sftp-server.c.orig 2008-06-17 01:49:15.000000000 +0100
+++ openssh-4.7p1/sftp-server.c 2008-06-17 01:33:15.000000000 +0100
@@ -990,6 +990,7 @@ process_rename(void)
/* Race-free rename of regular files */
if (link(oldpath, newpath) == -1) {
if (errno == EOPNOTSUPP
+ || errno == ENOSYS
#ifdef LINK_OPNOTSUPP_ERRNO
|| errno == LINK_OPNOTSUPP_ERRNO
#endif
Reply to: