(wrong string) ée

From: <git_AT_suckless.org>
Date: Wed, 5 Oct 2016 18:50:35 +0200 (CEST)

commit e8a3a3ec374c4321cb00c323749d29f7ad60ff91
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Thu Mar 31 03:03:37 2016 +0200
Commit: FRIGN <dev_AT_frign.de>
CommitDate: Wed Oct 5 18:48:10 2016 +0200

    test: -erwx test against effetive uid/gid, not real
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/test.c b/test.c
index 3fe12c3..6045e4e 100644
--- a/test.c
+++ b/test.c
_AT_@ -2,6 +2,7 @@
 #include <sys/stat.h>
 
 #include <ctype.h>
+#include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
 
_AT_@ -71,10 +72,10 @@ static int unary_u(char *s) { struct stat buf; if ( stat(s, &buf)) return 0; ret
 static int unary_n(char *s) { return *s; }
 static int unary_z(char *s) { return !*s; }
 
-static int unary_e(char *s) { return !access(s, F_OK); }
-static int unary_r(char *s) { return !access(s, R_OK); }
-static int unary_w(char *s) { return !access(s, W_OK); }
-static int unary_x(char *s) { return !access(s, X_OK); }
+static int unary_e(char *s) { return !faccessat(AT_FDCWD, s, F_OK, AT_EACCESS); }
+static int unary_r(char *s) { return !faccessat(AT_FDCWD, s, R_OK, AT_EACCESS); }
+static int unary_w(char *s) { return !faccessat(AT_FDCWD, s, W_OK, AT_EACCESS); }
+static int unary_x(char *s) { return !faccessat(AT_FDCWD, s, X_OK, AT_EACCESS); }
 
 static int unary_t(char *s) { int fd = enstrtonum(2, s, 0, INT_MAX); return isatty(fd); }
 
Received on Wed Oct 05 2016 - 18:50:35 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 05 2016 - 19:00:20 CEST