Browse Source

more error handling for writefreq

OPENBSD_5_9
Brent Cook 8 years ago
parent
commit
52a1b53757
12 changed files with 48 additions and 11 deletions
  1. +1
    -1
      patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch
  2. +1
    -1
      patches/0002-EAI_NODATA-does-not-exist-everywhere.patch
  3. +1
    -1
      patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch
  4. +1
    -1
      patches/0004-check-if-rdomain-support-is-available.patch
  5. +1
    -1
      patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch
  6. +1
    -1
      patches/0006-allow-overriding-default-user-and-file-locations.patch
  7. +1
    -1
      patches/0007-add-p-option-to-create-a-pid-file.patch
  8. +1
    -1
      patches/0008-initialize-setproctitle-where-needed.patch
  9. +1
    -1
      patches/0009-Notify-the-user-when-constraint-support-is-disabled.patch
  10. +1
    -1
      patches/0010-add-a-method-for-updating-the-realtime-clock-on-sync.patch
  11. +1
    -1
      patches/0011-Deal-with-missing-SO_TIMESTAMP.patch
  12. +37
    -0
      patches/0012-check-result-of-ftello-ftruncate.patch

+ 1
- 1
patches/0001-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch View File

@ -1,7 +1,7 @@
From 477c93ac049d28361ebe4f194ca710e681c92b14 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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.


+ 1
- 1
patches/0002-EAI_NODATA-does-not-exist-everywhere.patch View File

@ -1,7 +1,7 @@
From 9ecbfcea549e7bcd36b380892240fcd2f671edb7 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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.


+ 1
- 1
patches/0003-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch View File

@ -1,7 +1,7 @@
From d75fce3c40a9e24d8af8a568581e1882d21eb520 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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 ++++++++


+ 1
- 1
patches/0004-check-if-rdomain-support-is-available.patch View File

@ -1,7 +1,7 @@
From 222700a524b3466607b84c9a896aa8278c4d1aa9 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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


+ 1
- 1
patches/0005-update-ntpd.conf-to-indicate-OS-dependent-options.patch View File

@ -1,7 +1,7 @@
From f1e8552352638f4214768df629e9020507e4af05 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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 <dererk@debian.org>


+ 1
- 1
patches/0006-allow-overriding-default-user-and-file-locations.patch View File

@ -1,7 +1,7 @@
From fdb958c8a66e32287aa5292200d0777f9f96784a Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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.


+ 1
- 1
patches/0007-add-p-option-to-create-a-pid-file.patch View File

@ -1,7 +1,7 @@
From b4f723b7fd4c3a56f8b0e08da5998fa31bac5673 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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.


+ 1
- 1
patches/0008-initialize-setproctitle-where-needed.patch View File

@ -1,7 +1,7 @@
From f86daab4bb1d41bcdcbdaeb6370c500962a09675 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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.


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

@ -1,7 +1,7 @@
From 93555bfc44a0eb2039f625ab6a5badde63fa5215 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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.


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

@ -1,7 +1,7 @@
From 340f04a6e14b05803e376c22b0c9170407b6b77d Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
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
---


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

@ -1,7 +1,7 @@
From 93d09a37b9a3eb129c2d61db505082ca23ca12f1 Mon Sep 17 00:00:00 2001
From: Brent Cook <bcook@openbsd.org>
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" <henson@acm.org>


+ 37
- 0
patches/0012-check-result-of-ftello-ftruncate.patch View File

@ -0,0 +1,37 @@
From 4715ab95e394b979df49a30cf50db306f50f30e6 Mon Sep 17 00:00:00 2001
From: Brent Cook <bcook@openbsd.org>
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

Loading…
Cancel
Save