Browse Source

portability fixes

OPENBSD_5_9
Brent Cook 9 years ago
parent
commit
a18259d9b9
6 changed files with 22 additions and 12 deletions
  1. +2
    -0
      include/unistd.h
  2. +14
    -6
      patches/0009-initialize-setproctitle-where-needed.patch
  3. +1
    -1
      patches/0010-Notify-the-user-when-constraint-support-is-disabled.patch
  4. +3
    -3
      patches/0011-add-a-method-for-updating-the-realtime-clock-on-sync.patch
  5. +1
    -1
      patches/0012-Deal-with-missing-SO_TIMESTAMP.patch
  6. +1
    -1
      update.sh

+ 2
- 0
include/unistd.h View File

@ -8,6 +8,8 @@
#ifndef LIBCOMPAT_UNISTD_H #ifndef LIBCOMPAT_UNISTD_H
#define LIBCOMPAT_UNISTD_H #define LIBCOMPAT_UNISTD_H
#define pledge(request, paths) 0
#ifndef HAVE_GETENTROPY #ifndef HAVE_GETENTROPY
int getentropy(void *buf, size_t buflen); int getentropy(void *buf, size_t buflen);
#endif #endif


+ 14
- 6
patches/0009-initialize-setproctitle-where-needed.patch View File

@ -1,4 +1,4 @@
From 3f56ed57c9f7dcf2c77d29fadb307d10664c5075 Mon Sep 17 00:00:00 2001
From 0c286469c195738efc45001b1fcd4f8b4044a141 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com> From: Brent Cook <busterb@gmail.com>
Date: Mon, 12 Jan 2015 06:18:31 -0600 Date: Mon, 12 Jan 2015 06:18:31 -0600
Subject: [PATCH 09/12] initialize setproctitle where needed Subject: [PATCH 09/12] initialize setproctitle where needed
@ -6,11 +6,11 @@ Subject: [PATCH 09/12] initialize setproctitle where needed
We need to save a copy of argv and __progname to avoid setproctitle We need to save a copy of argv and __progname to avoid setproctitle
clobbering them. clobbering them.
--- ---
src/usr.sbin/ntpd/ntpd.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
src/usr.sbin/ntpd/ntpd.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
index 40570ee..b86d6ed 100644
index 40570ee..3d0ceb2 100644
--- a/src/usr.sbin/ntpd/ntpd.c --- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c
@@ -116,6 +116,13 @@ usage(void) @@ -116,6 +116,13 @@ usage(void)
@ -27,14 +27,13 @@ index 40570ee..b86d6ed 100644
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@@ -145,6 +152,19 @@ main(int argc, char *argv[])
@@ -145,6 +152,18 @@ main(int argc, char *argv[])
log_init(1); /* log to stderr until daemonized */ log_init(1); /* log to stderr until daemonized */
+ __progname = get_progname(argv[0]); + __progname = get_progname(argv[0]);
+ +
+#ifndef HAVE_SETPROCTITLE +#ifndef HAVE_SETPROCTITLE
+ int i;
+ /* Prepare for later setproctitle emulation */ + /* Prepare for later setproctitle emulation */
+ saved_argv = calloc(argc + 1, sizeof(*saved_argv)); + saved_argv = calloc(argc + 1, sizeof(*saved_argv));
+ for (i = 0; i < argc; i++) + for (i = 0; i < argc; i++)
@ -47,6 +46,15 @@ index 40570ee..b86d6ed 100644
while ((ch = getopt(argc, argv, "df:np:sSv")) != -1) { while ((ch = getopt(argc, argv, "df:np:sSv")) != -1) {
switch (ch) { switch (ch) {
case 'd': case 'd':
@@ -549,7 +568,7 @@ readfreq(void)
freqfp = fopen(DRIFTFILE, "w");
return;
}
-
+
freqfp = fdopen(fd, "r+");
/* if we're adjusting frequency already, don't override */
-- --
2.6.3 2.6.3

+ 1
- 1
patches/0010-Notify-the-user-when-constraint-support-is-disabled.patch View File

@ -1,4 +1,4 @@
From bdbcdad24473d94d2871650e65adba694e078a7b Mon Sep 17 00:00:00 2001
From c685d444684c047721ce4c3789aa50eab7ed7a91 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com> From: Brent Cook <busterb@gmail.com>
Date: Fri, 27 Mar 2015 23:14:15 -0500 Date: Fri, 27 Mar 2015 23:14:15 -0500
Subject: [PATCH 10/12] Notify the user when constraint support is disabled. Subject: [PATCH 10/12] Notify the user when constraint support is disabled.


+ 3
- 3
patches/0011-add-a-method-for-updating-the-realtime-clock-on-sync.patch View File

@ -1,4 +1,4 @@
From c826fa9409c17c67c347707fb146b22915815449 Mon Sep 17 00:00:00 2001
From 4a446e2cfe1792cd75af53b515fe0b71b6c97b0f Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com> From: Brent Cook <busterb@gmail.com>
Date: Mon, 4 May 2015 04:27:29 -0500 Date: Mon, 4 May 2015 04:27:29 -0500
Subject: [PATCH 11/12] add a method for updating the realtime clock on sync Subject: [PATCH 11/12] add a method for updating the realtime clock on sync
@ -9,7 +9,7 @@ from Christian Weisgerber
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
index b86d6ed..7cccb75 100644
index 3d0ceb2..eef7d2c 100644
--- a/src/usr.sbin/ntpd/ntpd.c --- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c
@@ -54,6 +54,7 @@ const char *ctl_lookup_option(char *, const char **); @@ -54,6 +54,7 @@ const char *ctl_lookup_option(char *, const char **);
@ -20,7 +20,7 @@ index b86d6ed..7cccb75 100644
volatile sig_atomic_t quit = 0; volatile sig_atomic_t quit = 0;
volatile sig_atomic_t reconfig = 0; volatile sig_atomic_t reconfig = 0;
@@ -487,6 +488,7 @@ ntpd_adjtime(double d)
@@ -486,6 +487,7 @@ ntpd_adjtime(double d)
else if (!firstadj && olddelta.tv_sec == 0 && olddelta.tv_usec == 0) else if (!firstadj && olddelta.tv_sec == 0 && olddelta.tv_usec == 0)
synced = 1; synced = 1;
firstadj = 0; firstadj = 0;


+ 1
- 1
patches/0012-Deal-with-missing-SO_TIMESTAMP.patch View File

@ -1,4 +1,4 @@
From 38933e5e9b3aa2d1b6d2b6fcb609494694fdfe44 Mon Sep 17 00:00:00 2001
From 585ee6ed92a06261aea08b05963789652f32a997 Mon Sep 17 00:00:00 2001
From: Brent Cook <bcook@openbsd.org> From: Brent Cook <bcook@openbsd.org>
Date: Sun, 6 Dec 2015 22:35:38 -0600 Date: Sun, 6 Dec 2015 22:35:38 -0600
Subject: [PATCH 12/12] Deal with missing SO_TIMESTAMP Subject: [PATCH 12/12] Deal with missing SO_TIMESTAMP


+ 1
- 1
update.sh View File

@ -45,7 +45,7 @@ for i in explicit_bzero.c strlcpy.c strlcat.c; do
done done
$CP_LIBC $libc_src/stdlib/reallocarray.c compat $CP_LIBC $libc_src/stdlib/reallocarray.c compat
$CP_LIBC $libc_src/stdlib/strtonum.c compat $CP_LIBC $libc_src/stdlib/strtonum.c compat
$CP $libc_src/crypt/arc4random.c compat
$CP_LIBC $libc_src/crypt/arc4random.c compat
$CP_LIBC $libc_src/crypt/arc4random_uniform.c compat $CP_LIBC $libc_src/crypt/arc4random_uniform.c compat
$CP_LIBC $libc_src/crypt/chacha_private.h compat $CP_LIBC $libc_src/crypt/chacha_private.h compat
$CP_LIBC $libc_src/hash/md5.c compat $CP_LIBC $libc_src/hash/md5.c compat


Loading…
Cancel
Save