summaryrefslogtreecommitdiff
path: root/sbin/isakmpd
diff options
context:
space:
mode:
authorMoritz Jodeit <moritz@cvs.openbsd.org>2007-04-08 11:15:31 +0000
committerMoritz Jodeit <moritz@cvs.openbsd.org>2007-04-08 11:15:31 +0000
commit0fffac0aeda088fd63bf322dbd132e2d801a43f2 (patch)
tree2e1be31e7c60bbc9a184965ce982362c2ba7b98c /sbin/isakmpd
parent36fdf571f5d92d3f0d3bc74bac82226f5139d79c (diff)
o Kill another strerror() from a call to log_error(),
which already adds the errno string. o Avoid closing fd, if it's -1. o Don't replace illegal pathes with /dev/null in m_priv_local_sanitize_path(). All callers skip it anyways, in the failure case. ok hshoexer@
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r--sbin/isakmpd/monitor.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c
index 92c3d75eedf..e76d82cbab6 100644
--- a/sbin/isakmpd/monitor.c
+++ b/sbin/isakmpd/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.68 2007/04/02 08:16:32 moritz Exp $ */
+/* $OpenBSD: monitor.c,v 1.69 2007/04/08 11:15:30 moritz Exp $ */
/*
* Copyright (c) 2003 Håkan Olsson. All rights reserved.
@@ -220,8 +220,7 @@ monitor_open(const char *path, int flags, mode_t mode)
fd = mm_receive_fd(m_state.s);
if (fd < 0) {
- log_error("monitor_open: mm_receive_fd () failed: %s",
- strerror(errno));
+ log_error("monitor_open: mm_receive_fd () failed");
return -1;
}
@@ -521,19 +520,17 @@ m_priv_getfd(void)
err = EACCES;
v = -1;
} else {
- v = open(path, flags, mode);
- if (v < 0)
+ if ((v = open(path, flags, mode)) == -1)
err = errno;
}
must_write(&err, sizeof err);
- if (v > 0 && mm_send_fd(m_state.s, v)) {
- log_error("m_priv_getfd: read/write operation failed");
+ if (v != -1) {
+ if (mm_send_fd(m_state.s, v) == -1)
+ log_error("m_priv_getfd: sending fd failed");
close(v);
- return;
}
- close(v);
}
/* Privileged: called by monitor_loop. */
@@ -710,9 +707,7 @@ m_priv_local_sanitize_path(char *path, size_t pmax, int flags)
return 0;
bad_path:
- log_print("m_priv_local_sanitize_path: illegal path \"%.1023s\", "
- "replaced with \"/dev/null\"", path);
- strlcpy(path, "/dev/null", pmax);
+ log_print("m_priv_local_sanitize_path: illegal path \"%.1023s\"", path);
return 1;
}