Browse Source

Rename session_socket_blockmode() to session_socket_nonblockmode(),

removing its second parameter and the enum() that provided the
values for said parameter.
The function was only called with the second parameter set to one
value (BM_NONBLOCKING) from the enum(). So just do the right thing.
Similar to changes made in smtpd.
While here remove the pointless third parameter from the fcntl(F_GETFL)
call.
No functional change.
ok guenther@ bcook@ deraadt@
OPENBSD_6_0
krw 8 years ago
parent
commit
846730a3f8
2 changed files with 8 additions and 16 deletions
  1. +6
    -9
      src/usr.sbin/ntpd/control.c
  2. +2
    -7
      src/usr.sbin/ntpd/ntpd.h

+ 6
- 9
src/usr.sbin/ntpd/control.c View File

@ -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");


+ 2
- 7
src/usr.sbin/ntpd/ntpd.h View File

@ -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 *);


Loading…
Cancel
Save