diff options
author | roberto <roberto@FreeBSD.org> | 2008-08-22 15:58:00 +0000 |
---|---|---|
committer | roberto <roberto@FreeBSD.org> | 2008-08-22 15:58:00 +0000 |
commit | b85c7169a740b2edf0106ad59fdaa1b0160f823c (patch) | |
tree | 2b9fb7f64eacb322e95695e412c923e97ba33e88 /contrib/ntp/ntpd/ntp_filegen.c | |
parent | 1d197cfe9feac6bc29537d8e53c30b6435937b95 (diff) | |
parent | 7a6072eb585696f8856cd498c3fd194cf49f14c6 (diff) | |
download | FreeBSD-src-b85c7169a740b2edf0106ad59fdaa1b0160f823c.zip FreeBSD-src-b85c7169a740b2edf0106ad59fdaa1b0160f823c.tar.gz |
Merge ntpd & friends 4.2.4p5 from vendor/ntp/dist into head. Next commit
will update usr.sbin/ntp to match this.
MFC after: 2 weeks
Diffstat (limited to 'contrib/ntp/ntpd/ntp_filegen.c')
-rw-r--r-- | contrib/ntp/ntpd/ntp_filegen.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/contrib/ntp/ntpd/ntp_filegen.c b/contrib/ntp/ntpd/ntp_filegen.c index 59a1d91..932d1b6 100644 --- a/contrib/ntp/ntpd/ntp_filegen.c +++ b/contrib/ntp/ntpd/ntp_filegen.c @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif #include <stdio.h> @@ -55,6 +55,25 @@ static int valid_fileref P((char *, char *)); static FILEGEN *filegen_unregister P((char *)); #endif /* UNUSED */ +static void filegen_init P((char *, const char *, FILEGEN *)); + +/* + * filegen_init + */ + +static void +filegen_init(char *prefix, const char *basename, FILEGEN *fp) +{ + fp->fp = NULL; + fp->prefix = prefix; /* Yes, this is TOTALLY lame! */ + fp->basename = (char*)emalloc(strlen(basename) + 1); + strcpy(fp->basename, basename); + fp->id = 0; + fp->type = FILEGEN_DAY; + fp->flag = FGEN_FLAG_LINK; /* not yet enabled !!*/ +} + + /* * open a file generation according to the current settings of gen * will also provide a link to basename if requested to do so @@ -169,7 +188,8 @@ filegen_open( free(savename); } else { /* - * there is at least a second link tpo this file + * there is at least a second link to + * this file. * just remove the conflicting one */ if ( @@ -335,6 +355,11 @@ filegen_setup( * reopen new file generation file on change of generation id */ if (gen->fp == NULL || gen->id != new_gen) { +#if DEBUG + if (debug) + printf("filegen %0x %lu %lu %lu\n", gen->type, now, + gen->id, new_gen); +#endif filegen_open(gen, new_gen); } } @@ -477,6 +502,7 @@ filegen_get( void filegen_register( + char *prefix, const char *name, FILEGEN *filegen ) @@ -487,6 +513,9 @@ filegen_register( if (debug > 3) printf("filegen_register(\"%s\",%x)\n", name, (u_int)filegen); #endif + + filegen_init(prefix, name, filegen); + while (*f) { if ((*f)->name == name || strcmp(name, (*f)->name) == 0) { #ifdef XXX /* this gives the Alpha compiler fits */ |