GNOME Bugzilla – Bug 50815
Incorrect assumption on pid_t
Last modified: 2004-12-22 21:47:04 UTC
Parts of gnome-libs thinks pid_t is int. That may or may not be true. I suggest casting to long and using "%ld". Not perfect, but C does not leave many options. gnome-exec.c: In function `gnome_execute_async_with_env_fds': gnome-exec.c:210: warning: int format, pid_t arg (arg 4) gnome-moz-remote.c: In function `mozilla_remote_obtain_lock': gnome-moz-remote.c:332: warning: int format, pid_t arg (arg 4) gnome-client.c: In function `gnome_client_set_process_id': gnome-client.c:1656: warning: int format, pid_t arg (arg 4) gnome-client.c: In function `gnome_real_client_connect': gnome-client.c:2216: warning: int format, pid_t arg (arg 4) gnome_segv.c: In function `main': gnome_segv.c:135: warning: int format, pid_t arg (arg 4) gnome_segv.c:154: warning: int format, pid_t arg (arg 4) debug.c: In function `__rsd_setDebugLevels': debug.c:356: warning: int format, pid_t arg (arg 3)
What flags are used here? I get no warnings on a standard run with gcc-2.96 from Red Hat 7.1
No special flags, gcc-2.7.2, if I recall. But you miss the point. On your system, it might very well be that pid_t is an int. Then you would not get the warning, even though the code is not right. On my system, however, pid_t is not an int. I think it's a long. FYI, this is a Solaris system.
Created attachment 6529 [details] [review] Patch to cast pid_t to a long
Is this ok? I'm not sure if I should cast the calls to getpid() too?
Marking fixed. Please repoen with details on any cases that are missing.