From 52a1b5375798836ee27d307f3493688cd7d9d468 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Mon, 21 Dec 2015 05:56:09 -0600 Subject: [PATCH] more error handling for writefreq --- ...records-on-IPv4-networks-more-libera.patch | 2 +- ...EAI_NODATA-does-not-exist-everywhere.patch | 2 +- ...ll-in-sin_len-sin6_len-if-they-exist.patch | 2 +- ...heck-if-rdomain-support-is-available.patch | 2 +- ...onf-to-indicate-OS-dependent-options.patch | 2 +- ...ding-default-user-and-file-locations.patch | 2 +- ...07-add-p-option-to-create-a-pid-file.patch | 2 +- ...initialize-setproctitle-where-needed.patch | 2 +- ...-when-constraint-support-is-disabled.patch | 2 +- ...-updating-the-realtime-clock-on-sync.patch | 2 +- .../0011-Deal-with-missing-SO_TIMESTAMP.patch | 2 +- ...012-check-result-of-ftello-ftruncate.patch | 37 +++++++++++++++++++ 12 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 patches/0012-check-result-of-ftello-ftruncate.patch diff --git a/patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch b/patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch index fc452fe..3c390f5 100644 --- a/patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch +++ b/patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch @@ -1,7 +1,7 @@ From 477c93ac049d28361ebe4f194ca710e681c92b14 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:10:22 -0600 -Subject: [PATCH 01/11] Handle IPv6 DNS records on IPv4 networks more liberally +Subject: [PATCH 01/12] Handle IPv6 DNS records on IPv4 networks more liberally Rather than fail on IPv4 only networks when seeing an IPv6 DNS record, just give a warning. diff --git a/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch b/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch index cf8f241..3a82e18 100644 --- a/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch +++ b/patches/0002-EAI_NODATA-does-not-exist-everywhere.patch @@ -1,7 +1,7 @@ From 9ecbfcea549e7bcd36b380892240fcd2f671edb7 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:04:08 -0600 -Subject: [PATCH 02/11] EAI_NODATA does not exist everywhere +Subject: [PATCH 02/12] EAI_NODATA does not exist everywhere FreeBSD says it is deprecated #ifdef's it out. diff --git a/patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch b/patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch index fa90d0b..e571e75 100644 --- a/patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch +++ b/patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch @@ -1,7 +1,7 @@ From d75fce3c40a9e24d8af8a568581e1882d21eb520 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:02:50 -0600 -Subject: [PATCH 03/11] conditionally fill in sin_len/sin6_len if they exist +Subject: [PATCH 03/12] conditionally fill in sin_len/sin6_len if they exist --- src/usr.sbin/ntpd/config.c | 8 ++++++++ diff --git a/patches/0004-check-if-rdomain-support-is-available.patch b/patches/0004-check-if-rdomain-support-is-available.patch index 0a3e358..5b06c25 100644 --- a/patches/0004-check-if-rdomain-support-is-available.patch +++ b/patches/0004-check-if-rdomain-support-is-available.patch @@ -1,7 +1,7 @@ From 222700a524b3466607b84c9a896aa8278c4d1aa9 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:05:46 -0600 -Subject: [PATCH 04/11] check if rdomain support is available. +Subject: [PATCH 04/12] check if rdomain support is available. Handle FreeBSD's calling rdomain 'FIB'. - from naddy@openbsd.org diff --git a/patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch b/patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch index afa08e3..ce7282f 100644 --- a/patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch +++ b/patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch @@ -1,7 +1,7 @@ From f1e8552352638f4214768df629e9020507e4af05 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 30 Dec 2014 09:20:03 -0600 -Subject: [PATCH 05/11] update ntpd.conf to indicate OS-dependent options +Subject: [PATCH 05/12] update ntpd.conf to indicate OS-dependent options Also, clarify listening behavior based on a patch from Dererk diff --git a/patches/0006-allow-overriding-default-user-and-file-locations.patch b/patches/0006-allow-overriding-default-user-and-file-locations.patch index 6e66021..f5976c2 100644 --- a/patches/0006-allow-overriding-default-user-and-file-locations.patch +++ b/patches/0006-allow-overriding-default-user-and-file-locations.patch @@ -1,7 +1,7 @@ From fdb958c8a66e32287aa5292200d0777f9f96784a Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Thu, 1 Jan 2015 07:18:11 -0600 -Subject: [PATCH 06/11] allow overriding default user and file locations +Subject: [PATCH 06/12] allow overriding default user and file locations Allow the build process to override the default ntpd file paths and default user. diff --git a/patches/0007-add-p-option-to-create-a-pid-file.patch b/patches/0007-add-p-option-to-create-a-pid-file.patch index 6bf655e..d4d9a00 100644 --- a/patches/0007-add-p-option-to-create-a-pid-file.patch +++ b/patches/0007-add-p-option-to-create-a-pid-file.patch @@ -1,7 +1,7 @@ From b4f723b7fd4c3a56f8b0e08da5998fa31bac5673 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Wed, 31 Dec 2014 08:26:41 -0600 -Subject: [PATCH 07/11] add -p option to create a pid file +Subject: [PATCH 07/12] add -p option to create a pid file This is used in both the Gentoo and Debian ports. diff --git a/patches/0008-initialize-setproctitle-where-needed.patch b/patches/0008-initialize-setproctitle-where-needed.patch index fde26be..4872e59 100644 --- a/patches/0008-initialize-setproctitle-where-needed.patch +++ b/patches/0008-initialize-setproctitle-where-needed.patch @@ -1,7 +1,7 @@ From f86daab4bb1d41bcdcbdaeb6370c500962a09675 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Mon, 12 Jan 2015 06:18:31 -0600 -Subject: [PATCH 08/11] initialize setproctitle where needed +Subject: [PATCH 08/12] initialize setproctitle where needed We need to save a copy of argv and __progname to avoid setproctitle clobbering them. diff --git a/patches/0009-Notify-the-user-when-constraint-support-is-disabled.patch b/patches/0009-Notify-the-user-when-constraint-support-is-disabled.patch index bd874ef..93b4e91 100644 --- a/patches/0009-Notify-the-user-when-constraint-support-is-disabled.patch +++ b/patches/0009-Notify-the-user-when-constraint-support-is-disabled.patch @@ -1,7 +1,7 @@ From 93555bfc44a0eb2039f625ab6a5badde63fa5215 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Fri, 27 Mar 2015 23:14:15 -0500 -Subject: [PATCH 09/11] Notify the user when constraint support is disabled. +Subject: [PATCH 09/12] Notify the user when constraint support is disabled. Update the manpage and make a constraint line a fatal error if it is configured but ntpd is built without libtls present. diff --git a/patches/0010-add-a-method-for-updating-the-realtime-clock-on-sync.patch b/patches/0010-add-a-method-for-updating-the-realtime-clock-on-sync.patch index 6668717..e0d9af4 100644 --- a/patches/0010-add-a-method-for-updating-the-realtime-clock-on-sync.patch +++ b/patches/0010-add-a-method-for-updating-the-realtime-clock-on-sync.patch @@ -1,7 +1,7 @@ From 340f04a6e14b05803e376c22b0c9170407b6b77d Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Mon, 4 May 2015 04:27:29 -0500 -Subject: [PATCH 10/11] add a method for updating the realtime clock on sync +Subject: [PATCH 10/12] add a method for updating the realtime clock on sync from Christian Weisgerber --- diff --git a/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch b/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch index 2f25b2e..5c96fce 100644 --- a/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch +++ b/patches/0011-Deal-with-missing-SO_TIMESTAMP.patch @@ -1,7 +1,7 @@ From 93d09a37b9a3eb129c2d61db505082ca23ca12f1 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 6 Dec 2015 22:35:38 -0600 -Subject: [PATCH 11/11] Deal with missing SO_TIMESTAMP +Subject: [PATCH 11/12] Deal with missing SO_TIMESTAMP from Paul B. Henson" diff --git a/patches/0012-check-result-of-ftello-ftruncate.patch b/patches/0012-check-result-of-ftello-ftruncate.patch new file mode 100644 index 0000000..59be1b0 --- /dev/null +++ b/patches/0012-check-result-of-ftello-ftruncate.patch @@ -0,0 +1,37 @@ +From 4715ab95e394b979df49a30cf50db306f50f30e6 Mon Sep 17 00:00:00 2001 +From: Brent Cook +Date: Mon, 21 Dec 2015 05:53:20 -0600 +Subject: [PATCH 12/12] check result of ftello/ftruncate + +--- + src/usr.sbin/ntpd/ntpd.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c +index d7281c1..7df6326 100644 +--- a/src/usr.sbin/ntpd/ntpd.c ++++ b/src/usr.sbin/ntpd/ntpd.c +@@ -592,6 +592,7 @@ writefreq(double d) + { + int r; + static int warnonce = 1; ++ int off; + + if (freqfp == NULL) + return 0; +@@ -605,8 +606,10 @@ writefreq(double d) + } + return 0; + } +- ftruncate(fileno(freqfp), ftello(freqfp)); +- fsync(fileno(freqfp)); ++ off = ftello(freqfp); ++ if (off == -1 || ftruncate(fileno(freqfp), off) == -1) ++ log_warnx("can't truncate %s", DRIFTFILE); ++ fsync(fileno(freqfp)); + return 1; + } + +-- +2.6.4 +