]> Sergey Matveev's repositories - nnn.git/commitdiff
Avoid faccessat(..., AT_SYM_NOFOLLOW) with musl libc
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 13 May 2021 20:41:59 +0000 (02:11 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 13 May 2021 20:41:59 +0000 (02:11 +0530)
See https://www.openwall.com/lists/musl/2014/09/25/1

src/nnn.c

index 6dd11066b49c215f3d0238623ec7795dbba5f4a2..bd4d344514b03f4b2c9dc2ec0ac27540483a05f8 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -6932,7 +6932,7 @@ nochange:
                        }
 
                        /* Check if another file with same name exists */
-                       if (faccessat(fd, tmp, F_OK, AT_SYMLINK_NOFOLLOW) != -1) {
+                       if (fstatat(fd, tmp, &sb, AT_SYMLINK_NOFOLLOW) == 0) {
                                if (sel == SEL_RENAME) {
                                        /* Overwrite file with same name? */
                                        if (!xconfirm(get_input(messages[MSG_OVERWRITE]))) {