From c1c8357d05ed0039af411d3fd91d83e27be5edab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Eivind=20N=C3=A6ss?= Date: Mon, 20 Sep 2021 10:05:17 -0700 Subject: [PATCH] Fixing GCC warning with unused return value from ftruncate(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Eivind Næss --- pppd/plugins/radius/buildreq.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 */ -- 2.39.2