X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fplugins%2Fradius%2Fbuildreq.c;h=562790aa7887ea8d174021cce062a85abbcf843c;hp=3edd5ea92e1c0e0a864975670f5fa57b8aa87aa0;hb=c1c8357d05ed0039af411d3fd91d83e27be5edab;hpb=05f088613bebc9fb743c309e9b9390d376387f1c diff --git a/pppd/plugins/radius/buildreq.c b/pppd/plugins/radius/buildreq.c index 3edd5ea..562790a 100644 --- a/pppd/plugins/radius/buildreq.c +++ b/pppd/plugins/radius/buildreq.c @@ -94,7 +94,7 @@ unsigned char rc_get_seqnbr(void) { FILE *sf; int tries = 1; - int seq_nbr, pos; + int seq_nbr, pos, ret; char *seqfile = rc_conf_str("seqfile"); if ((sf = fopen(seqfile, "a+")) == NULL) @@ -135,7 +135,10 @@ unsigned char rc_get_seqnbr(void) } rewind(sf); - ftruncate(fileno(sf),0); + ret = ftruncate(fileno(sf),0); + if (ret != 0) { + error("rc_get_seqnbr: couldn't truncate sequence file, %m"); + } fprintf(sf,"%d\n", (seq_nbr+1) & UCHAR_MAX); fflush(sf); /* fflush because a process may read it between the do_unlock and fclose */