summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd/util
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-09-30 02:20:25 +0000
committerache <ache@FreeBSD.org>1994-09-30 02:20:25 +0000
commitd21eaeac3b0cb7dbac9797dc3d36e72516881d44 (patch)
treed552e2b0cb1c6c9fa6b47fc51bce20d4fc04336d /usr.sbin/xntpd/util
parenta83f1d347bef78cb3ee63e3d0cdc91ddb7090c95 (diff)
downloadFreeBSD-src-d21eaeac3b0cb7dbac9797dc3d36e72516881d44.zip
FreeBSD-src-d21eaeac3b0cb7dbac9797dc3d36e72516881d44.tar.gz
Use getbootfile() properly, old code cause reboots somethimes
Diffstat (limited to 'usr.sbin/xntpd/util')
-rw-r--r--usr.sbin/xntpd/util/tickadj.c14
1 files changed, 11 insertions, 3 deletions
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 <unistd.h>
#endif /* SYS_VAX */
+#if defined(HAVE_GETBOOTFILE)
+#include <paths.h>
+#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",
OpenPOWER on IntegriCloud