]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/radius/buildreq.c
Merge branch 'fix-compiler-warnings-2' of https://github.com/enaess/ppp
[ppp.git] / pppd / plugins / radius / buildreq.c
index 3edd5ea92e1c0e0a864975670f5fa57b8aa87aa0..562790aa7887ea8d174021cce062a85abbcf843c 100644 (file)
@@ -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 */