From: Eivind Næss Date: Mon, 20 Sep 2021 17:05:17 +0000 (-0700) Subject: Fixing GCC warning with unused return value from ftruncate(). X-Git-Tag: ppp-2.5.0~56^2~15 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=c1c8357d05ed0039af411d3fd91d83e27be5edab;hp=05f088613bebc9fb743c309e9b9390d376387f1c Fixing GCC warning with unused return value from ftruncate(). Signed-off-by: Eivind Næss --- 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 */