diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1994-09-30 02:20:25 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1994-09-30 02:20:25 +0000 |
commit | c019533a0bedce8b5d3e2d49fef9b401a82b0168 (patch) | |
tree | d552e2b0cb1c6c9fa6b47fc51bce20d4fc04336d /usr.sbin/xntpd | |
parent | c364e17e10fef6ef3a6c30dfff6094e2295e584c (diff) | |
download | src-c019533a0bedce8b5d3e2d49fef9b401a82b0168.tar.gz src-c019533a0bedce8b5d3e2d49fef9b401a82b0168.zip |
Use getbootfile() properly, old code cause reboots somethimes
Notes
Notes:
svn path=/head/; revision=3221
Diffstat (limited to 'usr.sbin/xntpd')
-rw-r--r-- | usr.sbin/xntpd/util/tickadj.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.sbin/xntpd/util/tickadj.c b/usr.sbin/xntpd/util/tickadj.c index 796d822dd6eb..41d4c4634041 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", |