[csw-devel] [PATCH 1/4] Test for O_DIRECTORY

Maciej Blizinski maciej at opencsw.org
Wed Feb 29 10:48:26 CET 2012


O_DIRECTORY is not declared on Solaris 10. Test for it and only use it when
available.
---
 configure.ac          |    1 +
 modules/misc/gnutls.c |    6 +++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index efb2e99..6ce41f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -492,6 +492,7 @@ dnl Check for usual libc functions
 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
 AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r if_nameindex if_nametoindex isatty lstat memalign mmap openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale])
 AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r inet_pton lldiv localtime_r nrand48 poll rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy strverscmp])
+AC_CHECK_DECLS([O_DIRECTORY])
 AC_CHECK_FUNCS(fdatasync,,
   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
 ])
diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c
index d52d3ec..44ce55d 100644
--- a/modules/misc/gnutls.c
+++ b/modules/misc/gnutls.c
@@ -467,7 +467,11 @@ static void gnutls_Addx509Directory (vlc_object_t *obj,
                                      const char *path, bool priv)
 {
     msg_Dbg (obj, "browsing x509 credentials in %s...", path);
-    int fd = vlc_open (path, O_RDONLY|O_DIRECTORY);
+    int fd = vlc_open (path, O_RDONLY
+#if HAVE_DECL_O_DIRECTORY
+        |O_DIRECTORY
+#endif
+    );
     if (fd == -1)
     {
         msg_Warn (obj, "cannot access x509 in %s: %m", path);
-- 
1.7.9



More information about the devel mailing list