From d21eaeac3b0cb7dbac9797dc3d36e72516881d44 Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 30 Sep 1994 02:20:25 +0000 Subject: Use getbootfile() properly, old code cause reboots somethimes --- usr.sbin/xntpd/util/tickadj.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'usr.sbin/xntpd/util/tickadj.c') diff --git a/usr.sbin/xntpd/util/tickadj.c b/usr.sbin/xntpd/util/tickadj.c index 796d822..41d4c46 100644 --- a/usr.sbin/xntpd/util/tickadj.c +++ b/usr.sbin/xntpd/util/tickadj.c @@ -11,6 +11,10 @@ #include #endif /* SYS_VAX */ +#if defined(HAVE_GETBOOTFILE) +#include +#endif + #ifdef SYS_LINUX #include "sys/timex.h" @@ -427,9 +431,7 @@ getoffsets(filex, tick_off, tickadj_off, dosync_off, noprintf_off) }; #endif char *kernels[] = { -#if __FreeBSD__ > 1 - (char *)getbootfile(), -#endif + "/kernel", "/vmunix", "/unix", "/mach", @@ -440,12 +442,18 @@ getoffsets(filex, tick_off, tickadj_off, dosync_off, noprintf_off) }; struct stat stbuf; +#ifdef HAVE_GETBOOTFILE + *kname = getbootfile(); + if (stat(*kname, &stbuf) == -1 || nlist(*kname, nl) == -1) + *kname = NULL; +#else for (kname = kernels; *kname != NULL; kname++) { if (stat(*kname, &stbuf) == -1) continue; if (nlist(*kname, nl) >= 0) break; } +#endif if (*kname == NULL) { (void) fprintf(stderr, "%s: nlist fails: can't find/read /vmunix or /unix\n", -- cgit v1.1