Skip to content
Commit 0e79797e authored by Adam Jackson's avatar Adam Jackson
Browse files

os: Fix warning in LockServer



The meson build gives me:

../os/utils.c: In function ‘LockServer’:
../os/utils.c:310:40: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
     snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid());
                                        ^~~~~~~~~
../os/utils.c:310:5: note: ‘snprintf’ output between 12 and 13 bytes into a destination of size 12
     snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid());
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Which seems to be due to the %d part meaning that a negative number's -
sign would be one wider than we're expecting. Fine, just coerce it to
unsigned.

Signed-off-by: default avatarAdam Jackson <ajax@redhat.com>
Reviewed-by: default avatarAlan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit aabf65d2)
parent 69ab094a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment