summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/ntpd/control.c15
-rw-r--r--usr.sbin/ntpd/ntpd.h9
2 files changed, 8 insertions, 16 deletions
diff --git a/usr.sbin/ntpd/control.c b/usr.sbin/ntpd/control.c
index 1ca323dbd0e..1fc7375c246 100644
--- a/usr.sbin/ntpd/control.c
+++ b/usr.sbin/ntpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.9 2015/12/05 13:12:16 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.10 2016/03/27 11:16:12 krw Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -77,7 +77,7 @@ control_init(char *path)
return (-1);
}
- session_socket_blockmode(fd, BM_NONBLOCK);
+ session_socket_nonblockmode(fd);
return (fd);
}
@@ -122,7 +122,7 @@ control_accept(int listenfd)
return (0);
}
- session_socket_blockmode(connfd, BM_NONBLOCK);
+ session_socket_nonblockmode(connfd);
if ((ctl_conn = calloc(1, sizeof(struct ctl_conn))) == NULL) {
log_warn("control_accept");
@@ -273,17 +273,14 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt)
}
void
-session_socket_blockmode(int fd, enum blockmodes bm)
+session_socket_nonblockmode(int fd)
{
int flags;
- if ((flags = fcntl(fd, F_GETFL, 0)) == -1)
+ if ((flags = fcntl(fd, F_GETFL)) == -1)
fatal("fcntl F_GETFL");
- if (bm == BM_NONBLOCK)
- flags |= O_NONBLOCK;
- else
- flags &= ~O_NONBLOCK;
+ flags |= O_NONBLOCK;
if ((flags = fcntl(fd, F_SETFL, flags)) == -1)
fatal("fcntl F_SETFL");
diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index 51b6751636d..f27e5af959d 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/usr.sbin/ntpd/ntpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.h,v 1.129 2016/01/27 21:48:34 reyk Exp $ */
+/* $OpenBSD: ntpd.h,v 1.130 2016/03/27 11:16:12 krw Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -265,11 +265,6 @@ struct ctl_show_sensor {
double correction;
};
-enum blockmodes {
- BM_NORMAL,
- BM_NONBLOCK
-};
-
struct ctl_conn {
TAILQ_ENTRY(ctl_conn) entry;
struct imsgbuf ibuf;
@@ -395,7 +390,7 @@ int control_accept(int);
struct ctl_conn *control_connbyfd(int);
int control_close(int);
int control_dispatch_msg(struct pollfd *, u_int *);
-void session_socket_blockmode(int, enum blockmodes);
+void session_socket_nonblockmode(int);
void build_show_status(struct ctl_show_status *);
void build_show_peer(struct ctl_show_peer *,
struct ntp_peer *);