empty. This avoids a spurious error at startup if the sequence file is
kept in /var/run, which is cleared on reboot.
- * $Id: buildreq.c,v 1.4 2002/10/01 09:51:01 fcusack Exp $
+ * $Id: buildreq.c,v 1.5 2003/04/25 08:10:46 fcusack Exp $
*
* Copyright (C) 1995,1997 Lars Fenneberg
*
*
* Copyright (C) 1995,1997 Lars Fenneberg
*
{
FILE *sf;
int tries = 1;
{
FILE *sf;
int tries = 1;
char *seqfile = rc_conf_str("seqfile");
if ((sf = fopen(seqfile, "a+")) == NULL)
char *seqfile = rc_conf_str("seqfile");
if ((sf = fopen(seqfile, "a+")) == NULL)
return rc_guess_seqnbr();
}
return rc_guess_seqnbr();
}
rewind(sf);
if (fscanf(sf, "%d", &seq_nbr) != 1) {
rewind(sf);
if (fscanf(sf, "%d", &seq_nbr) != 1) {
- rc_log(LOG_ERR,"rc_get_seqnbr: fscanf failure: %s", seqfile);
+ if (pos != ftell(sf)) {
+ /* file was not empty */
+ rc_log(LOG_ERR,"rc_get_seqnbr: fscanf failure: %s", seqfile);
+ }
seq_nbr = rc_guess_seqnbr();
}
seq_nbr = rc_guess_seqnbr();
}