]> source.dussan.org Git - rspamd.git/commitdiff
Check for libutil more strictly.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 20 Nov 2013 16:14:20 +0000 (16:14 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 20 Nov 2013 16:14:20 +0000 (16:14 +0000)
CMakeLists.txt
src/util.c

index fda25e11598ce22ab02a75105a60605391a6b1b7..b18e6bdb72ae198a028d12d904e9d9f4504f367b 100644 (file)
@@ -662,14 +662,15 @@ FIND_LIBRARY(LIBUTIL_LIBRARY NAMES util PATHS     PATH_SUFFIXES lib64 lib
                       /opt
                  DOC "Path where the libutil library can be found")
 IF(LIBUTIL_LIBRARY)
-       LIST(APPEND CMAKE_REQUIRED_LIBRARIES util)
-       CHECK_FUNCTION_EXISTS(pidfile_open HAVE_PIDFILE)
-       CHECK_FUNCTION_EXISTS(pidfile_fileno HAVE_PIDFILE_FILENO)
-
        FIND_FILE(HAVE_LIBUTIL_H NAMES libutil.h PATHS /usr/include
                                                                                           /opt/include
                                                                                           /usr/local/include
                                DOC "Path to libutil header")
+       IF(HAVE_LIBUTIL_H)
+               LIST(APPEND CMAKE_REQUIRED_LIBRARIES util)
+               CHECK_FUNCTION_EXISTS(pidfile_open HAVE_PIDFILE)
+               CHECK_FUNCTION_EXISTS(pidfile_fileno HAVE_PIDFILE_FILENO)
+       ENDIF(HAVE_LIBUTIL_H)
 ENDIF(LIBUTIL_LIBRARY)
 
 # Find libfetch (for FreeBSD)
index 7383f23d60fb02d69a1fbe5ee2c664256433a692..46e99c3095c0ed8385b45c1e1441588716f70baa 100644 (file)
@@ -2305,10 +2305,13 @@ rspamd_read_passphrase (gchar *buf, gint size, gint rwflag, gpointer key)
        gchar *end, *p, ch;
 
 restart:
-       if ((input = output = open (_PATH_TTY, O_RDWR | O_CLOEXEC)) == -1) {
+       if ((input = output = open (_PATH_TTY, O_RDWR)) == -1) {
                errno = ENOTTY;
                return 0;
        }
+       if (fcntl (input, F_SETFD, FD_CLOEXEC) == -1) {
+               msg_warn ("fcntl failed: %d, '%s'", errno, strerror (errno));
+       }
 
        /* Turn echo off */
        if (tcgetattr (input, &oterm) != 0) {