X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Fradius%2Fbuildreq.c;h=c1fda5abb547347a6448de76b38d7145a3c1673d;hb=HEAD;hp=3edd5ea92e1c0e0a864975670f5fa57b8aa87aa0;hpb=c58bf2e8023dd846683f09cb00e15d64143dac8c;p=ppp.git diff --git a/pppd/plugins/radius/buildreq.c b/pppd/plugins/radius/buildreq.c index 3edd5ea..c1fda5a 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 */ @@ -324,7 +327,7 @@ int rc_acct_using_server(SERVER *acctserver, if ((adt_vp = rc_avpair_add(&(data.send_pairs), PW_ACCT_DELAY_TIME, &dtime.tv_sec, 0, VENDOR_NONE)) == NULL) return (ERROR_RC); - get_time(&start_time); + ppp_get_time(&start_time); result = ERROR_RC; for(i=0; (imax) && (result != OK_RC) && (result != BADRESP_RC) ; i++) @@ -336,7 +339,7 @@ int rc_acct_using_server(SERVER *acctserver, rc_buildreq(&data, PW_ACCOUNTING_REQUEST, acctserver->name[i], acctserver->port[i], timeout, retries); - get_time(&dtime); + ppp_get_time(&dtime); dtime.tv_sec -= start_time.tv_sec; rc_avpair_assign(adt_vp, &dtime.tv_sec, 0);