xntpd(8) doesn't know about /kernel (do it right, use get_bootfile()).

This commit is contained in:
Paul Traina 1994-09-27 18:30:26 +00:00
parent d3c2cf7a80
commit 45fe7a082a
2 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,5 @@
DEFS_LOCAL=-DREFCLOCK -DPARSE
NTPDEFS= -DSYS_FREEBSD -DSYS_386BSD
NTPDEFS= -DSYS_FREEBSD -DSYS_386BSD -DHAVE_GETBOOTFILE
AUTHDEFS= -DMD5
CLOCKDEFS= -DLOCAL_CLOCK -DPST -DWWVB -DAS2201 -DGOES -DGPSTM -DOMEGA \
-DLEITCH -DTRAK

View File

@ -14,6 +14,10 @@
#include <utmp.h>
#endif
#if defined(HAVE_GETBOOTFILE)
#include <paths.h>
#endif
#include "ntpd.h"
#include "ntp_io.h"
#include "ntp_unixtime.h"
@ -309,7 +313,11 @@ clock_parms(tickadj, tick)
{""},
};
#endif
#ifdef HAVE_GETBOOTFILE
const char *kernelname;
#else
static char *kernelnames[] = {
"/kernel",
"/vmunix",
"/unix",
"/mach",
@ -321,6 +329,7 @@ clock_parms(tickadj, tick)
#endif
NULL
};
#endif
struct stat stbuf;
int vars[2];
@ -331,6 +340,11 @@ clock_parms(tickadj, tick)
* Check to see what to use for the object file for names and get
* the locations of the necessary kernel variables.
*/
#ifdef HAVE_GETBOOTFILE
kernelname = getbootfile();
if (kernelname &&
((stat(kernelname, &stbuf) == -1) || (nlist(kernelname, nl) < 0))) {
#else
for (i = 0; kernelnames[i] != NULL; i++) {
if (stat(kernelnames[i], &stbuf) == -1)
continue;
@ -338,6 +352,7 @@ clock_parms(tickadj, tick)
break;
}
if (kernelnames[i] == NULL) {
#endif
syslog(LOG_ERR,
"Clock init couldn't find kernel object file");
exit(3);