From: Kevin McCarthy Date: Tue, 14 Aug 2018 21:31:34 +0000 (-0700) Subject: Remove compare_stat() call in safe_rename(). X-Git-Tag: mutt-1-11-rel~85 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38647ab907fff85fdf4248532a31c9951bd15634;p=mutt Remove compare_stat() call in safe_rename(). Some filesystems, such as sshfs, implement hard links strangely. The hard link is created, but is represented by a different inode number by the sshfs layer. The current maildir code goes into an infinite loop in this case. Remove the compare_stat() and trust that a link() return code of 0 means the link really did get created. Still, keep the stats just as a minor check. --- diff --git a/lib.c b/lib.c index 6f7113e1..9a5d5325 100644 --- a/lib.c +++ b/lib.c @@ -517,12 +517,21 @@ int safe_rename (const char *src, const char *target) * did already exist. */ +#if 0 + /* + * Remove this check, because it causes problems with maildir on + * filesystems that don't properly support hard links, such as + * sshfs. The filesystem creates the link, but the resulting file + * is given a different inode number by the sshfs layer. This + * results in an infinite loop creating links. + */ if (compare_stat (&ssb, &tsb) == -1) { dprint (1, (debugfile, "safe_rename: stat blocks for %s and %s diverge; pretending EEXIST.\n", src, target)); errno = EEXIST; return -1; } +#endif /* * Unlink the original link. Should we really ignore the return