From: Roy Marples Date: Sat, 25 Jan 2014 02:31:45 +0000 (+0000) Subject: Fix monofile truncation. X-Git-Tag: v6.3.0~88 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0588e17af4963993420857c61c071a2c9b5d00e1;p=thirdparty%2Fdhcpcd.git Fix monofile truncation. --- diff --git a/auth.c b/auth.c index b3a583d7..cfffe471 100644 --- a/auth.c +++ b/auth.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "config.h" #include "auth.h" @@ -327,8 +328,8 @@ get_next_rdm_monotonic(void) } rdm++; - fseek(fp, 0, SEEK_SET); - if (ftruncate(fileno(fp)) == -1 || + if (fseek(fp, 0, SEEK_SET) == -1 || + ftruncate(fileno(fp), 0) == -1 || fprintf(fp, "0x%016" PRIu64 "\n", rdm) != 19) { if (!last_rdm_set) {