Use faccessat for rc_dir and tmp_dir

This commit is contained in:
Tatsuya Kinoshita
2023-01-12 20:41:23 +09:00
parent baaaec0029
commit 9a33001df0
5 changed files with 9 additions and 2 deletions

View File

@@ -212,6 +212,7 @@ typedef long clen_t;
#undef HAVE_GETPASSPHRASE
#define HAVE_CHDIR
#define HAVE_MKDTEMP
#define HAVE_FACCESSAT
#define SETJMP(env) sigsetjmp(env,1)

View File

@@ -145,6 +145,7 @@ typedef long clen_t;
#undef HAVE_GETPASSPHRASE
#undef HAVE_CHDIR
#undef HAVE_MKDTEMP
#undef HAVE_FACCESSAT
#undef HAVE_SETPGRP
#undef HAVE_SETLOCALE
#undef HAVE_LANGINFO_CODESET

2
configure vendored
View File

@@ -9550,7 +9550,7 @@ _ACEOF
for ac_func in strcasecmp strcasestr strchr memcpy strerror bcopy setpgrp chdir mkdtemp getcwd getwd readlink setenv putenv strtoll stroq atoll atoq symlink readlink lstat srand48 srandom getpassphrase waitpid setlocale
for ac_func in strcasecmp strcasestr strchr memcpy strerror bcopy setpgrp chdir mkdtemp faccessat getcwd getwd readlink setenv putenv strtoll stroq atoll atoq symlink readlink lstat srand48 srandom getpassphrase waitpid setlocale
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View File

@@ -151,7 +151,7 @@ dnl AC_FUNC_MEMCMP
dnl AC_FUNC_MMAP
dnl AC_FUNC_SETVBUF_REVERSED
dnl AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strcasecmp strcasestr strchr memcpy strerror bcopy setpgrp chdir mkdtemp getcwd getwd readlink setenv putenv strtoll stroq atoll atoq symlink readlink lstat srand48 srandom getpassphrase waitpid setlocale)
AC_CHECK_FUNCS(strcasecmp strcasestr strchr memcpy strerror bcopy setpgrp chdir mkdtemp faccessat getcwd getwd readlink setenv putenv strtoll stroq atoll atoq symlink readlink lstat srand48 srandom getpassphrase waitpid setlocale)
AC_FUNC_STRFTIME
AC_FUNC_WAIT3
AC_FUNC_SETPGRP

5
rc.c
View File

@@ -1282,6 +1282,11 @@ do_recursive_mkdir(const char *dir)
*ch = tmp;
} while (*ch++ != '\0');
#ifdef HAVE_FACCESSAT
if (faccessat(AT_FDCWD, dir, W_OK|X_OK, AT_EACCESS) < 0) {
return -1;
}
#endif
return 0;
}