aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/charon-tkm/src/charon-tkm.c7
-rw-r--r--src/charon/charon.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/charon-tkm/src/charon-tkm.c b/src/charon-tkm/src/charon-tkm.c
index 1941e7407..7f014237a 100644
--- a/src/charon-tkm/src/charon-tkm.c
+++ b/src/charon-tkm/src/charon-tkm.c
@@ -211,7 +211,12 @@ static bool check_pidfile()
int fd;
fd = fileno(pidfile);
- if (fd == -1 || fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
+ if (fd == -1)
+ {
+ DBG1(DBG_DMN, "unable to determine fd for '%s'", pidfile_name);
+ return TRUE;
+ }
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
{
DBG1(DBG_LIB, "setting FD_CLOEXEC for '%s' failed: %s",
pidfile_name, strerror(errno));
diff --git a/src/charon/charon.c b/src/charon/charon.c
index 5d866ee0d..f23717034 100644
--- a/src/charon/charon.c
+++ b/src/charon/charon.c
@@ -221,7 +221,12 @@ static bool check_pidfile()
int fd;
fd = fileno(pidfile);
- if (fd == -1 || fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
+ if (fd == -1)
+ {
+ DBG1(DBG_DMN, "unable to determine fd for '"PID_FILE"'");
+ return TRUE;
+ }
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
{
DBG1(DBG_LIB, "setting FD_CLOEXEC for '"PID_FILE"' failed: %s",
strerror(errno));