From: Pekka Paalanen Date: Tue, 15 May 2012 12:23:41 +0000 (+0300) Subject: Use eaccess() only if available X-Git-Tag: xkbcommon-0.2.0~579 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8bdef139a62c74d002a976e830f9d8e09628aea3;p=platform%2Fupstream%2Flibxkbcommon.git Use eaccess() only if available Fixes build on Android. Signed-off-by: Pekka Paalanen --- diff --git a/configure.ac b/configure.ac index 54bd6a5..1fc6436 100644 --- a/configure.ac +++ b/configure.ac @@ -62,6 +62,8 @@ if test "x$ac_cv_func_strcasecmp" = xno || \ AC_MSG_ERROR([C library does not support strcasecmp/strncasecmp]) fi +AC_CHECK_FUNCS([eaccess euidaccess]) + # Build native compiler needed for makekeys AC_ARG_VAR([CC_FOR_BUILD], [Build native C compiler program]) if test "x$CC_FOR_BUILD" = x; then diff --git a/src/context.c b/src/context.c index 2472d36..3f2f13d 100644 --- a/src/context.c +++ b/src/context.c @@ -72,8 +72,14 @@ xkb_context_include_path_append(struct xkb_context *ctx, const char *path) return 0; if (!S_ISDIR(stat_buf.st_mode)) return 0; + +#if defined(HAVE_EACCESS) if (eaccess(path, R_OK | X_OK) != 0) return 0; +#elif defined(HAVE_EUIDACCESS) + if (euidaccess(path, R_OK | X_OK) != 0) + return 0; +#endif ctx->include_paths[ctx->num_include_paths] = strdup(path); if (!ctx->include_paths[ctx->num_include_paths])