]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Don’t assume pid fits in unsigned long
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 13 Aug 2024 01:04:42 +0000 (18:04 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 15 Aug 2024 06:25:46 +0000 (23:25 -0700)
* src/system.c (sys_wait_command): Convert pid_t to intmax_t,
not to unsigned long.

src/system.c

index b7976a89cedf0930434516ba790086fd17526ba3..296053fc7911fcb7fd221b166e4ed6ec13553d4f 100644 (file)
@@ -805,17 +805,17 @@ sys_wait_command (void)
   if (WIFEXITED (status))
     {
       if (!ignore_command_error_option && WEXITSTATUS (status))
-       ERROR ((0, 0, _("%lu: Child returned status %d"),
-               (unsigned long) global_pid, WEXITSTATUS (status)));
+       ERROR ((0, 0, _("%jd: Child returned status %d"),
+               intmax (global_pid), WEXITSTATUS (status)));
     }
   else if (WIFSIGNALED (status))
     {
-      WARN ((0, 0, _("%lu: Child terminated on signal %d"),
-            (unsigned long) global_pid, WTERMSIG (status)));
+      WARN ((0, 0, _("%jd: Child terminated on signal %d"),
+            intmax (global_pid), WTERMSIG (status)));
     }
   else
-    ERROR ((0, 0, _("%lu: Child terminated on unknown reason"),
-           (unsigned long) global_pid));
+    ERROR ((0, 0, _("%jd: Child terminated on unknown reason"),
+           intmax (global_pid)));
 
   global_pid = -1;
 }