From: Brendan Cully Date: Fri, 6 Apr 2007 19:54:46 +0000 (-0700) Subject: safe_rename: fall back to rename on ENOSYS and EPERM as well as EXDEV. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81833c1f002d5f0c9d335d34f71c5794138b5704;p=neomutt safe_rename: fall back to rename on ENOSYS and EPERM as well as EXDEV. sshfs returns ENOSYS when attempting cross-directory links. vfat returns EPERM. --- diff --git a/lib.c b/lib.c index a0cbca22f..53ccb8423 100644 --- a/lib.c +++ b/lib.c @@ -447,9 +447,10 @@ int safe_rename (const char *src, const char *target) dprint (1, (debugfile, "safe_rename: link (%s, %s) failed: %s (%d)\n", src, target, strerror (errno), errno)); - if (errno == EXDEV) + /* FUSE may return ENOSYS. VFAT may return EPERM */ + if (errno == EXDEV || errno == ENOSYS || errno == EPERM) { - dprint (1, (debugfile, "safe_rename: errno was EXDEV; trying rename...\n")); + dprint (1, (debugfile, "safe_rename: trying rename...\n")); if (rename (src, target) == -1) { dprint (1, (debugfile, "safe_rename: rename (%s, %s) failed: %s (%d)\n", src, target, strerror (errno), errno));