[svn-commits] tilghman: trunk r191367 - in /trunk: ./ include/asterisk/ main/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Apr 30 12:41:02 CDT 2009
Author: tilghman
Date: Thu Apr 30 12:40:58 2009
New Revision: 191367
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=191367
Log:
Detect eaccess (or euidaccess) before using it.
Reported by Andrew Lindh via the -dev list.
Modified:
trunk/configure
trunk/configure.ac
trunk/include/asterisk/autoconfig.h.in
trunk/main/asterisk.c
Modified: trunk/configure.ac
URL: http://svn.digium.com/svn-view/asterisk/trunk/configure.ac?view=diff&rev=191367&r1=191366&r2=191367
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Thu Apr 30 12:40:58 2009
@@ -351,7 +351,7 @@
AC_FUNC_STRTOD
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([asprintf atexit closefrom dup2 endpwent ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
+AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
AC_CHECK_FUNCS([glob])
Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/svn-view/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=191367&r1=191366&r2=191367
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Thu Apr 30 12:40:58 2009
@@ -220,8 +220,14 @@
/* Define to 1 if you have the `dup2' function. */
#undef HAVE_DUP2
+/* Define to 1 if you have the `eaccess' function. */
+#undef HAVE_EACCESS
+
/* Define to 1 if you have the `endpwent' function. */
#undef HAVE_ENDPWENT
+
+/* Define to 1 if you have the `euidaccess' function. */
+#undef HAVE_EUIDACCESS
/* Define this to indicate the ${EXP_DESCRIP} library */
#undef HAVE_EXP
Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/asterisk.c?view=diff&rev=191367&r1=191366&r2=191367
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Thu Apr 30 12:40:58 2009
@@ -3433,26 +3433,33 @@
if (geteuid() && ast_opt_dump_core) {
if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) {
ast_log(LOG_WARNING, "Unable to set the process for core dumps after changing to a non-root user. %s\n", strerror(errno));
- }
- }
+ }
+ }
+#endif
{
+#if defined(HAVE_EACCESS) || defined(HAVE_EUIDACCESS)
+#if defined(HAVE_EUIDACCESS) && !defined(HAVE_EACCESS)
+#define eaccess euidaccess
+#endif
char dir[PATH_MAX];
if (!getcwd(dir, sizeof(dir)) || eaccess(dir, R_OK | X_OK | F_OK)) {
ast_log(LOG_ERROR, "Unable to access the running directory (%s). Changing to '/' for compatibility.\n", strerror(errno));
/* If we cannot access the CWD, then we couldn't dump core anyway,
* so chdir("/") won't break anything. */
if (chdir("/")) {
- ast_log(LOG_ERROR, "chdir() failed?!! %s\n", strerror(errno));
- }
- } else if (!ast_opt_no_fork && !ast_opt_dump_core) {
+ /* chdir(/) should never fail, so this ends up being a no-op */
+ ast_log(LOG_ERROR, "chdir(\"/\") failed?!! %s\n", strerror(errno));
+ }
+ } else
+#endif /* defined(HAVE_EACCESS) || defined(HAVE_EUIDACCESS) */
+ if (!ast_opt_no_fork && !ast_opt_dump_core) {
/* Backgrounding, but no cores, so chdir won't break anything. */
if (chdir("/")) {
ast_log(LOG_ERROR, "Unable to chdir(\"/\") ?!! %s\n", strerror(errno));
}
}
}
-#endif
ast_term_init();
printf("%s", term_end());
More information about the svn-commits
mailing list