Bugzilla – Attachment 596 Details for
Bug 823
Rename fails on fat32 partitions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Make sftp rename fall back if fs doesn't support links (eg fat)
openssh-sftpserv-rename.patch (text/plain), 1.09 KB, created by
Darren Tucker
on 2004-04-06 12:03:13 AEST
(
hide
)
Description:
Make sftp rename fall back if fs doesn't support links (eg fat)
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2004-04-06 12:03:13 AEST
Size:
1.09 KB
patch
obsolete
>Index: sftp-server.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/sftp-server.c,v >retrieving revision 1.45 >diff -u -p -r1.45 sftp-server.c >--- sftp-server.c 19 Feb 2004 21:15:04 -0000 1.45 >+++ sftp-server.c 6 Apr 2004 01:53:45 -0000 >@@ -819,9 +819,25 @@ process_rename(void) > 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 == EOPNOTSUPP) { >+ struct stat st; >+ >+ /* >+ * fs doesn't support links, so fall back to >+ * stat+rename. This is racy. >+ */ >+ if (stat(newpath, &st) == -1) { >+ if (rename(oldpath, newpath) == -1) >+ status = >+ errno_to_portable(errno); >+ else >+ status = SSH2_FX_OK; >+ } >+ } else { >+ status = errno_to_portable(errno); >+ } >+ } else if (unlink(oldpath) == -1) { > status = errno_to_portable(errno); > /* clean spare link */ > unlink(newpath);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 823
:
596
|
597
|
662