X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Fradius%2Fradiusclient%2Flib%2Fbuildreq.c;h=a24a20ba66c5b1c4ead9e5ed1249c56a0d78c481;hb=4b9bf9ae2701487191810e564aaa4672eb95130e;hp=cd80d191b53d7172a988596f8a30c35122d63ee4;hpb=32be3676b6d3ad8db2052b8d445e7ef4b9ca6352;p=ppp.git diff --git a/pppd/plugins/radius/radiusclient/lib/buildreq.c b/pppd/plugins/radius/radiusclient/lib/buildreq.c index cd80d19..a24a20b 100644 --- a/pppd/plugins/radius/radiusclient/lib/buildreq.c +++ b/pppd/plugins/radius/radiusclient/lib/buildreq.c @@ -1,5 +1,5 @@ /* - * $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 * @@ -96,7 +96,7 @@ unsigned char rc_get_seqnbr(void) { FILE *sf; int tries = 1; - int seq_nbr; + int seq_nbr, pos; char *seqfile = rc_conf_str("seqfile"); if ((sf = fopen(seqfile, "a+")) == NULL) @@ -126,9 +126,13 @@ unsigned char rc_get_seqnbr(void) return rc_guess_seqnbr(); } + pos = ftell(sf); 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(); }