Explicitly cast getpid() result to int.
authorEmil Mikulic <emikulic@gmail.com>
Wed, 13 Jan 2016 09:18:30 +0000 (20:18 +1100)
committerEmil Mikulic <emikulic@gmail.com>
Wed, 13 Jan 2016 09:18:30 +0000 (20:18 +1100)
This placates cppcheck.

darkhttpd.c

index 3dde728..388739a 100644 (file)
@@ -2581,7 +2581,7 @@ static void pidfile_create(void) {
         err(1, "ftruncate() failed");
     }
 
-    snprintf(pidstr, sizeof(pidstr), "%u", getpid());
+    snprintf(pidstr, sizeof(pidstr), "%d", (int)getpid());
     if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) {
         error = errno;
         pidfile_remove();