summary refs log tree commit diff
path: root/bin/cash/test.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-01-10 20:01:33 -0500
committerJune McEnroe <june@causal.agency>2019-01-10 20:01:33 -0500
commitf9bd24dc9aff9c68a0892da2c1ca337a6eddd9c3 (patch)
treea3b8336c9d1f3e694e3509003c23ac326a8bb888 /bin/cash/test.c
parentReplace st_mtim with st_mtimespec (diff)
downloadsrc-f9bd24dc9aff9c68a0892da2c1ca337a6eddd9c3.tar.gz
src-f9bd24dc9aff9c68a0892da2c1ca337a6eddd9c3.zip
Replace eaccess with faccessat
Diffstat (limited to 'bin/cash/test.c')
-rw-r--r--bin/cash/test.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/cash/test.c b/bin/cash/test.c
index e74c4f4c..a153cdb3 100644
--- a/bin/cash/test.c
+++ b/bin/cash/test.c
@@ -23,6 +23,7 @@ __FBSDID("$FreeBSD: releng/12.0/bin/test/test.c 298232 2016-04-19 00:38:07Z arau
 #include <ctype.h>
 #include <err.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <stdarg.h>
@@ -375,18 +376,18 @@ filstat(char *nm, enum token mode)
 
 	switch (mode) {
 	case FILRD:
-		return (eaccess(nm, R_OK) == 0);
+		return (faccessat(AT_FDCWD, nm, R_OK, AT_EACCESS) == 0);
 	case FILWR:
-		return (eaccess(nm, W_OK) == 0);
+		return (faccessat(AT_FDCWD, nm, W_OK, AT_EACCESS) == 0);
 	case FILEX:
 		/* XXX work around eaccess(2) false positives for superuser */
-		if (eaccess(nm, X_OK) != 0)
+		if (faccessat(AT_FDCWD, nm, X_OK, AT_EACCESS) != 0)
 			return 0;
 		if (S_ISDIR(s.st_mode) || geteuid() != 0)
 			return 1;
 		return (s.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0;
 	case FILEXIST:
-		return (eaccess(nm, F_OK) == 0);
+		return (faccessat(AT_FDCWD, nm, F_OK, AT_EACCESS) == 0);
 	case FILREG:
 		return S_ISREG(s.st_mode);
 	case FILDIR:
> 2020-08-30Sandbox pounce with unveil(2)June McEnroe 2020-08-28Refactor certificate loading and load all certs from config pathsJune McEnroe 2020-08-27Sandbox pounce with pledge(2)June McEnroe unveil(2) is a bit complicated to apply to this, I'll have to think about it more. 2020-08-27Sandbox calico with pledge(2) and unveil(2)June McEnroe 2020-08-27Add support for OpenBSDJune McEnroe 2020-08-27Remove rc scriptsJune McEnroe 2020-08-27contrib/palaver: Fix documented database pathJune McEnroe 2020-08-27contrib/palaver: Remove rc scriptJune McEnroe 2020-08-27contrib/palaver: Fix database search and creationJune McEnroe 2020-08-27contrib/palaver: Use pounce's XDG directoryJune McEnroe 2020-08-27contrib/palaver: Only allow HTTPSJune McEnroe 2020-08-25Support the pounce_env rc variableJune McEnroe 2020-08-25Remove deprecated option namesJune McEnroe The next release will be 2.0 so these can be removed now. 2020-08-25Document configuration and data file searchJune McEnroe 2020-08-24Use dataOpen for save fileJune McEnroe 2020-08-24Use configOpen to load localCAJune McEnroe 2020-08-24Use configPath to load client cert/privJune McEnroe 2020-08-24Use configOpen in getopt_configJune McEnroe 2020-08-24Import xdg.c from catgirlJune McEnroe 2020-08-23Replace “RAND_bytes” by “getentropy”Issam E. Maghni This removes the dependency on libcrypto. Signed-off-by: Issam E. Maghni <issam.e.maghni@mailbox.org> 2020-08-16contrib/palaver: Add no message preview flagsJune McEnroe 2020-08-13contrib/palaver: Don't set channel for PMsJune McEnroe 2020-08-13Fix unintended interception of NICK after registrationJune McEnroe Another bug caused by trying to support broken clients. I'm annoyed. 2020-08-12Add Additional Components section to READMEJune McEnroe 2020-08-12Document -L / palaver optionJune McEnroe 2020-08-11contrib/palaver: Document service configurationJune McEnroe 2020-08-11contrib/palaver: Add install target and rc scriptJune McEnroe 2020-08-11contrib/palaver: Implement command and notificationsJune McEnroe