- (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.
diff --git a/sftp-server.c b/sftp-server.c
index 39a6bda..1ff4750 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -840,7 +840,11 @@
 	else if (S_ISREG(sb.st_mode)) {
 		/* Race-free rename of regular files */
 		if (link(oldpath, newpath) == -1) {
-			if (errno == EOPNOTSUPP) {
+			if (errno == EOPNOTSUPP
+#ifdef LINK_OPNOTSUPP_ERRNO
+			    || errno == LINK_OPNOTSUPP_ERRNO
+#endif
+			    ) {
 				struct stat st;
 
 				/*