core: Fix unextractable translation string

Glib format specifiers are not gettext friendly. It even emits a
warning: src/core/main-utils.c:196: warning: Although being used in a
format string position, the msgid is not a valid C format string."

One possible solution is to use the equivalent format specifiers from
<inttypes.h> like PRId64, available since C99.

Even simpler is to cast the value to a type that is big enough to hold
it according to C specs (i.e. for int64: long long).

Fixes: 50f34217f9 ('main: use _nm_utils_ascii_str_to_int64 instead of strtol for reading pid')
This commit is contained in:
Íñigo Huguet 2023-12-15 20:52:13 +01:00
parent 9150a60ae7
commit c86f9e47fb

View file

@ -192,10 +192,7 @@ nm_main_utils_ensure_not_running_pidfile(const char *pidfile)
if (strcmp(process_name, prgname) == 0) {
/* Check that the process exists */
if (kill(pid, 0) == 0) {
fprintf(stderr,
_("%s is already running (pid %" G_GINT64_FORMAT ")\n"),
prgname,
(gint64) pid);
fprintf(stderr, _("%s is already running (pid %lld)\n"), prgname, (long long) pid);
exit(1);
}
}