On Wed, Apr 22, 2026 at 09:39:08AM -0600, Todd C. Miller wrote:
> On Wed, 22 Apr 2026 11:03:23 +1000, David Leadbeater wrote:
>
> > This is because ntp.c attempts to open /usr/share/zoneinfo/right/UTC.
> > The following fixes the pledge issues. Although I don't know where
> > /usr/share/zoneinfo/right/ is supposed to come from and strangely I
> > don't see an error from failing to open this.
>
> We don't install /usr/share/zoneinfo/right by default. Like most
> systems, we just install the POSIX zoneinfo files and not the vesion
> that counts leap seconds.
>
> Since the rdate -c option won't work with the default install, is
> there any reason to keep it?
Here is a diff making -c a noop.
I have left ntpleaps.h here, two macros from it are needed. I think this could
be cleaned up, but this diff keeps the removal simple as a candidate for
release.
diff --git usr.sbin/rdate/Makefile usr.sbin/rdate/Makefile
index 2ca709ac1b2..5f0e619d8b7 100644
--- usr.sbin/rdate/Makefile
+++ usr.sbin/rdate/Makefile
@@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.8 2026/03/27 14:33:58 deraadt Exp $
PROG= rdate
-SRCS= rdate.c ntp.c ntpleaps.c
+SRCS= rdate.c ntp.c
CFLAGS+=-Wall
DPADD+= ${LIBUTIL}
LDADD+= -lutil
diff --git usr.sbin/rdate/ntp.c usr.sbin/rdate/ntp.c
index 4aed956d62f..7107082872c 100644
--- usr.sbin/rdate/ntp.c
+++ usr.sbin/rdate/ntp.c
@@ -120,7 +120,7 @@ struct ntp_data {
u_int64_t xmitck;
};
-void ntp_client(const char *, int, struct timeval *, struct timeval *, int);
+void ntp_client(const char *, int, struct timeval *, struct timeval *);
int sync_ntp(int, const struct sockaddr *, double *, double *);
int write_packet(int, struct ntp_data *);
int read_packet(int, struct ntp_data *, double *, double *);
@@ -132,11 +132,9 @@ void create_timeval(double, struct timeval *, struct
timeval *);
void print_packet(const struct ntp_data *);
#endif
-int corrleaps;
-
void
ntp_client(const char *hostname, int family, struct timeval *new,
- struct timeval *adjust, int leapflag)
+ struct timeval *adjust)
{
struct addrinfo hints, *res0, *res;
double offset, error;
@@ -154,10 +152,6 @@ ntp_client(const char *hostname, int family, struct
timeval *new,
if (pledge("stdio inet", NULL) == -1)
err(1, "pledge");
- corrleaps = leapflag;
- if (corrleaps)
- ntpleaps_init();
-
s = -1;
for (res = res0; res; res = res->ai_next) {
s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
@@ -458,8 +452,6 @@ current_time(double offset)
*/
t = SEC_TO_TAI64(current.tv_sec);
- if (corrleaps)
- ntpleaps_sub(&t);
return (offset + TAI64_TO_SEC(t) + 1.0e-6 * current.tv_usec);
}
diff --git usr.sbin/rdate/rdate.8 usr.sbin/rdate/rdate.8
index 08d3c645f2d..a6682a21335 100644
--- usr.sbin/rdate/rdate.8
+++ usr.sbin/rdate/rdate.8
@@ -55,10 +55,6 @@ Use the
.Xr adjtime 2
call to gradually skew the local time to the
remote time rather than just hopping.
-.It Fl c
-Correct leap seconds.
-This should be used only when synchronizing to a server
-which does not correctly account for leap seconds.
.It Fl n
Use SNTP (RFC 5905).
This is the default.
diff --git usr.sbin/rdate/rdate.c usr.sbin/rdate/rdate.c
index e6c77711b4d..2e7dd9534e6 100644
--- usr.sbin/rdate/rdate.c
+++ usr.sbin/rdate/rdate.c
@@ -52,7 +52,7 @@
#define logwtmp(a,b,c)
#endif
-void ntp_client(const char *, int, struct timeval *, struct timeval *, int);
+void ntp_client(const char *, int, struct timeval *, struct timeval *);
extern char *__progname;
__dead void usage(void);
@@ -66,7 +66,7 @@ struct {
__dead void
usage(void)
{
- (void) fprintf(stderr, "usage: %s [-46acnpsv] host\n", __progname);
+ (void) fprintf(stderr, "usage: %s [-46anpsv] host\n", __progname);
exit(1);
}
@@ -74,7 +74,7 @@ int
main(int argc, char **argv)
{
int pr = 0, silent = 0, verbose = 0;
- int slidetime = 0, corrleaps = 0;
+ int slidetime = 0;
char *hname;
int c, p[2], pid;
int family = PF_UNSPEC;
@@ -106,7 +106,7 @@ main(int argc, char **argv)
break;
case 'c':
- corrleaps = 1;
+ /* noop */
break;
case 'v':
@@ -144,8 +144,7 @@ main(int argc, char **argv)
setvbuf(stdout, NULL, _IOFBF, 0);
setvbuf(stderr, NULL, _IOFBF, 0);
- ntp_client(hname, family, &pdata.new,
- &pdata.adjust, corrleaps);
+ ntp_client(hname, family, &pdata.new, &pdata.adjust);
if (write(STDOUT_FILENO, &pdata, sizeof pdata) != sizeof pdata)
exit(1);