@ -1,42 +0,0 @@ | |||||
From 27f9b15fed29f671606ce6f5322c6407c0456615 Mon Sep 17 00:00:00 2001 | |||||
From: Brent Cook <busterb@gmail.com> | |||||
Date: Tue, 30 Dec 2014 08:58:26 -0600 | |||||
Subject: [PATCH 01/16] include time.h for strftime, clock_gettime | |||||
Add a missing include for time.h to get the definitions of | |||||
clock_gettime and strftime. | |||||
--- | |||||
src/usr.sbin/ntpd/ntpd.c | 1 + | |||||
src/usr.sbin/ntpd/util.c | 2 ++ | |||||
2 files changed, 3 insertions(+) | |||||
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c | |||||
index 4634fae..17ebf67 100644 | |||||
--- a/src/usr.sbin/ntpd/ntpd.c | |||||
+++ b/src/usr.sbin/ntpd/ntpd.c | |||||
@@ -30,6 +30,7 @@ | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
+#include <time.h> | |||||
#include <unistd.h> | |||||
#include <err.h> | |||||
diff --git a/src/usr.sbin/ntpd/util.c b/src/usr.sbin/ntpd/util.c | |||||
index 9d78d6e..638dc92 100644 | |||||
--- a/src/usr.sbin/ntpd/util.c | |||||
+++ b/src/usr.sbin/ntpd/util.c | |||||
@@ -17,8 +17,10 @@ | |||||
*/ | |||||
#include <sys/time.h> | |||||
+ | |||||
#include <limits.h> | |||||
#include <stdio.h> | |||||
+#include <time.h> | |||||
#include "ntpd.h" | |||||
-- | |||||
1.9.1 | |||||
@ -1,49 +0,0 @@ | |||||
From 0d94976a5b804c445cb8c34d2d0665c379e86ee5 Mon Sep 17 00:00:00 2001 | |||||
From: Brent Cook <busterb@gmail.com> | |||||
Date: Tue, 30 Dec 2014 08:59:19 -0600 | |||||
Subject: [PATCH 02/16] removed unused libevent header and structures in ntpd.h | |||||
It does not appear anything actually uses libevent in ntpd, so remove | |||||
the libevent-using structures from ntpd.h | |||||
--- | |||||
src/usr.sbin/ntpd/ntpd.h | 10 ---------- | |||||
1 file changed, 10 deletions(-) | |||||
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h | |||||
index 8095be3..aa9858b 100644 | |||||
--- a/src/usr.sbin/ntpd/ntpd.h | |||||
+++ b/src/usr.sbin/ntpd/ntpd.h | |||||
@@ -28,7 +28,6 @@ | |||||
#include <netdb.h> | |||||
#include <pwd.h> | |||||
#include <stdarg.h> | |||||
-#include <event.h> | |||||
#include <poll.h> | |||||
#include "ntp.h" | |||||
@@ -190,14 +189,6 @@ struct ntpd_conf { | |||||
u_int8_t filters; | |||||
}; | |||||
-struct imsgev { | |||||
- struct imsgbuf ibuf; | |||||
- void (*handler)(int, short, void *); | |||||
- struct event ev; | |||||
- void *data; | |||||
- short events; | |||||
-}; | |||||
- | |||||
struct ctl_show_status { | |||||
u_int peercnt; | |||||
u_int sensorcnt; | |||||
@@ -240,7 +231,6 @@ enum blockmodes { | |||||
struct ctl_conn { | |||||
TAILQ_ENTRY(ctl_conn) entry; | |||||
- struct imsgev iev; | |||||
struct imsgbuf ibuf; | |||||
}; | |||||
-- | |||||
1.9.1 | |||||
@ -1,36 +0,0 @@ | |||||
From 8d9e3d91cfb94f11873d9bed1d7e877572bb5579 Mon Sep 17 00:00:00 2001 | |||||
From: Brent Cook <busterb@gmail.com> | |||||
Date: Tue, 30 Dec 2014 09:01:57 -0600 | |||||
Subject: [PATCH 03/16] remove unused dns_pid | |||||
dns_pid is returned, but nothing is done with it. Was then intent to do | |||||
some extra error handling here? | |||||
--- | |||||
src/usr.sbin/ntpd/ntp.c | 4 ++-- | |||||
1 file changed, 2 insertions(+), 2 deletions(-) | |||||
diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c | |||||
index 2eb4285..ddbcedd 100644 | |||||
--- a/src/usr.sbin/ntpd/ntp.c | |||||
+++ b/src/usr.sbin/ntpd/ntp.c | |||||
@@ -79,7 +79,7 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf, | |||||
u_int pfd_elms = 0, idx2peer_elms = 0; | |||||
u_int listener_cnt, new_cnt, sent_cnt, trial_cnt; | |||||
u_int ctl_cnt; | |||||
- pid_t pid, dns_pid; | |||||
+ pid_t pid; | |||||
struct pollfd *pfd = NULL; | |||||
struct servent *se; | |||||
struct listen_addr *la; | |||||
@@ -118,7 +118,7 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf, | |||||
close(pipe_prnt[0]); | |||||
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_dns) == -1) | |||||
fatal("socketpair"); | |||||
- dns_pid = ntp_dns(pipe_dns, nconf, pw); | |||||
+ ntp_dns(pipe_dns, nconf, pw); | |||||
close(pipe_dns[1]); | |||||
if (stat(pw->pw_dir, &stb) == -1) | |||||
-- | |||||
1.9.1 | |||||
@ -1,29 +0,0 @@ | |||||
From a74e51f0e68d0d437c340a197ef7fcba8ab3b3aa Mon Sep 17 00:00:00 2001 | |||||
From: Brent Cook <busterb@gmail.com> | |||||
Date: Wed, 31 Dec 2014 22:39:58 -0600 | |||||
Subject: [PATCH 04/16] add MAX macro, used in a few places in ntpd | |||||
Do not assume that the system #includes happen to include a MAX macro | |||||
somewhere along the way. | |||||
--- | |||||
src/usr.sbin/ntpd/ntpd.h | 4 ++++ | |||||
1 file changed, 4 insertions(+) | |||||
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h | |||||
index aa9858b..61a447f 100644 | |||||
--- a/src/usr.sbin/ntpd/ntpd.h | |||||
+++ b/src/usr.sbin/ntpd/ntpd.h | |||||
@@ -72,6 +72,10 @@ | |||||
#define SENSOR_SCAN_INTERVAL (5*60) | |||||
#define SENSOR_DEFAULT_REFID "HARD" | |||||
+#ifndef MAX | |||||
+#define MAX(a, b) ((a) > (b) ? (a) : (b)) | |||||
+#endif | |||||
+ | |||||
enum client_state { | |||||
STATE_NONE, | |||||
STATE_DNS_INPROGRESS, | |||||
-- | |||||
1.9.1 | |||||
@ -1,99 +0,0 @@ | |||||
From 0a52220f114d2134d0e6180aa1c9fccdb6050700 Mon Sep 17 00:00:00 2001 | |||||
From: Brent Cook <busterb@gmail.com> | |||||
Date: Wed, 31 Dec 2014 22:08:09 -0600 | |||||
Subject: [PATCH 05/16] rename the s_un socket to avoid a variable called 'sun' | |||||
Solaris build environments seem to define 'sun' as a constant. | |||||
Hilarity ensues. | |||||
--- | |||||
src/usr.sbin/ntpd/control.c | 18 +++++++++--------- | |||||
src/usr.sbin/ntpd/ntpd.c | 12 ++++++------ | |||||
2 files changed, 15 insertions(+), 15 deletions(-) | |||||
diff --git a/src/usr.sbin/ntpd/control.c b/src/usr.sbin/ntpd/control.c | |||||
index 6c5b05d..eb3575b 100644 | |||||
--- a/src/usr.sbin/ntpd/control.c | |||||
+++ b/src/usr.sbin/ntpd/control.c | |||||
@@ -36,7 +36,7 @@ | |||||
int | |||||
control_init(char *path) | |||||
{ | |||||
- struct sockaddr_un sun; | |||||
+ struct sockaddr_un sock; | |||||
int fd; | |||||
mode_t old_umask; | |||||
@@ -45,10 +45,10 @@ control_init(char *path) | |||||
return (-1); | |||||
} | |||||
- bzero(&sun, sizeof(sun)); | |||||
- sun.sun_family = AF_UNIX; | |||||
- if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >= | |||||
- sizeof(sun.sun_path)) | |||||
+ bzero(&sock, sizeof(sock)); | |||||
+ sock.sun_family = AF_UNIX; | |||||
+ if (strlcpy(sock.sun_path, path, sizeof(sock.sun_path)) >= | |||||
+ sizeof(sock.sun_path)) | |||||
errx(1, "ctl socket name too long"); | |||||
if (unlink(path) == -1) | |||||
@@ -59,7 +59,7 @@ control_init(char *path) | |||||
} | |||||
old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH); | |||||
- if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) { | |||||
+ if (bind(fd, (struct sockaddr *)&sock, sizeof(sock)) == -1) { | |||||
log_warn("control_init: bind: %s", path); | |||||
close(fd); | |||||
umask(old_umask); | |||||
@@ -108,12 +108,12 @@ control_accept(int listenfd) | |||||
{ | |||||
int connfd; | |||||
socklen_t len; | |||||
- struct sockaddr_un sun; | |||||
+ struct sockaddr_un sock; | |||||
struct ctl_conn *ctl_conn; | |||||
- len = sizeof(sun); | |||||
+ len = sizeof(sock); | |||||
if ((connfd = accept(listenfd, | |||||
- (struct sockaddr *)&sun, &len)) == -1) { | |||||
+ (struct sockaddr *)&sock, &len)) == -1) { | |||||
if (errno != EWOULDBLOCK && errno != EINTR) | |||||
log_warn("control_accept: accept"); | |||||
return (0); | |||||
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c | |||||
index 17ebf67..d764a50 100644 | |||||
--- a/src/usr.sbin/ntpd/ntpd.c | |||||
+++ b/src/usr.sbin/ntpd/ntpd.c | |||||
@@ -527,7 +527,7 @@ writefreq(double d) | |||||
void | |||||
ctl_main(int argc, char *argv[]) | |||||
{ | |||||
- struct sockaddr_un sun; | |||||
+ struct sockaddr_un sock; | |||||
struct imsg imsg; | |||||
struct imsgbuf *ibuf_ctl; | |||||
int fd, n, done, ch, action; | |||||
@@ -580,12 +580,12 @@ ctl_main(int argc, char *argv[]) | |||||
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) | |||||
err(1, "ntpctl: socket"); | |||||
- bzero(&sun, sizeof(sun)); | |||||
- sun.sun_family = AF_UNIX; | |||||
- if (strlcpy(sun.sun_path, sockname, sizeof(sun.sun_path)) >= | |||||
- sizeof(sun.sun_path)) | |||||
+ bzero(&sock, sizeof(sock)); | |||||
+ sock.sun_family = AF_UNIX; | |||||
+ if (strlcpy(sock.sun_path, sockname, sizeof(sock.sun_path)) >= | |||||
+ sizeof(sock.sun_path)) | |||||
errx(1, "ctl socket name too long"); | |||||
- if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) | |||||
+ if (connect(fd, (struct sockaddr *)&sock, sizeof(sock)) == -1) | |||||
err(1, "connect: %s", sockname); | |||||
if ((ibuf_ctl = malloc(sizeof(struct imsgbuf))) == NULL) | |||||
-- | |||||
1.9.1 | |||||