aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-11-20 16:14:20 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-11-20 16:14:20 +0000
commitc370177c68eb3b327a9abef4e139dbad64db0a7a (patch)
tree878a3a940f23d30b4f4eb97ce97bcc6ef2295db4
parentc5bda0ed2981e45b6b96b62612ffb876ad094747 (diff)
downloadrspamd-c370177c68eb3b327a9abef4e139dbad64db0a7a.tar.gz
rspamd-c370177c68eb3b327a9abef4e139dbad64db0a7a.zip
Check for libutil more strictly.
-rw-r--r--CMakeLists.txt9
-rw-r--r--src/util.c5
2 files changed, 9 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fda25e115..b18e6bdb7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/src/util.c b/src/util.c
index 7383f23d6..46e99c309 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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) {