Merge branch 'make-nowarn-snprintf-call-va-end' of https://github.com/bvanassche/fio
authorJens Axboe <axboe@kernel.dk>
Tue, 5 Jun 2018 17:20:45 +0000 (11:20 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 5 Jun 2018 17:20:45 +0000 (11:20 -0600)
* 'make-nowarn-snprintf-call-va-end' of https://github.com/bvanassche/fio:
  Make nowarn_snprintf() call va_end()

lib/nowarn_snprintf.h

index 5c0f4d44e4edff657b0bb5ea4a3dc52e6b0a51a5..81a6d10849c7edd49f585a027db6399d305cd94f 100644 (file)
@@ -8,17 +8,20 @@ static inline int nowarn_snprintf(char *str, size_t size, const char *format,
                                  ...)
 {
        va_list args;
+       int res;
 
        va_start(args, format);
 #if __GNUC__ -0 >= 8
 #pragma GCC diagnostic push "-Wformat-truncation"
 #pragma GCC diagnostic ignored "-Wformat-truncation"
 #endif
-       return vsnprintf(str, size, format, args);
+       res = vsnprintf(str, size, format, args);
 #if __GNUC__ -0 >= 8
 #pragma GCC diagnostic pop "-Wformat-truncation"
 #endif
        va_end(args);
+
+       return res;
 }
 
 #endif