From ff5830c9fc83ee59be9351c7ff45c1e376bac22b Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 4 Dec 2007 14:11:10 +0100 Subject: [PATCH] Fix some gcc warnings on Solaris: warning: int format, pid_t arg warning: int format, long int arg int format, uid_t arg int format, gid_t arg --- command.c | 2 +- daemon.c | 6 +++--- ipc.c | 3 ++- server.c | 2 +- signal.c | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/command.c b/command.c index 379cc4d9..15fb7ab0 100644 --- a/command.c +++ b/command.c @@ -278,7 +278,7 @@ int com_si(int fd, int argc, __a_unused char * const * argv) "supported senders: %s\n" "%s", ut, mmd->num_played, - getppid(), + (int)getppid(), mmd->active_connections, mmd->num_commands, mmd->num_connects, diff --git a/daemon.c b/daemon.c index 931124e6..5d4cf699 100644 --- a/daemon.c +++ b/daemon.c @@ -62,7 +62,7 @@ FILE *open_log(const char *logfile_name) return NULL; if (!(logfile = fopen(logfile_name, "a"))) { PARA_EMERG_LOG("can not open %s, uid: %d\n", logfile_name, - getuid()); + (int)getuid()); exit(EXIT_FAILURE); } setlinebuf(logfile); @@ -123,7 +123,7 @@ void para_drop_privileges(const char *username, const char *groupname) } if (setgid(g->gr_gid) < 0) { PARA_EMERG_LOG("failed to set group id %d (%s)\n", - g->gr_gid, strerror(errno)); + (int)g->gr_gid, strerror(errno)); exit(EXIT_FAILURE); } } @@ -140,7 +140,7 @@ void para_drop_privileges(const char *username, const char *groupname) } PARA_INFO_LOG("%s", "dropping root privileges\n"); setuid(p->pw_uid); - PARA_DEBUG_LOG("uid: %d, euid: %d\n", getuid(), geteuid()); + PARA_DEBUG_LOG("uid: %d, euid: %d\n", (int)getuid(), (int)geteuid()); } /** diff --git a/ipc.c b/ipc.c index debf9d11..2cab3937 100644 --- a/ipc.c +++ b/ipc.c @@ -52,7 +52,8 @@ static void para_semop(int id, struct sembuf *sops, int num) PARA_NOTICE_LOG("semaphore set %d was removed\n", id); return; } - PARA_EMERG_LOG("fatal semop error %s: pid %d\n", strerror(errno), getpid()); + PARA_EMERG_LOG("fatal semop error %s: pid %d\n", strerror(errno), + (int)getpid()); exit(EXIT_FAILURE); } diff --git a/server.c b/server.c index 80cc8f46..d48a0c91 100644 --- a/server.c +++ b/server.c @@ -166,7 +166,7 @@ void para_log(int ll, const char* fmt,...) fprintf(outfd, "%i: ", ll); mypid = getpid(); if (conf.loglevel_arg <= INFO) - fprintf(outfd, "(%d) ", mypid); + fprintf(outfd, "(%d) ", (int)mypid); va_start(argp, fmt); vfprintf(outfd, fmt, argp); va_end(argp); diff --git a/signal.c b/signal.c index 55499796..3d1883f5 100644 --- a/signal.c +++ b/signal.c @@ -85,13 +85,13 @@ int para_reap_child(pid_t *pid) if (*pid < 0) return -ERRNO_TO_PARA_ERROR(errno); if (WIFEXITED(status)) - PARA_DEBUG_LOG("child %i exited. Exit status: %i\n", *pid, + PARA_DEBUG_LOG("child %i exited. Exit status: %i\n", (int)*pid, WEXITSTATUS(status)); else if (WIFSIGNALED(status)) - PARA_DEBUG_LOG("child %i was killed by signal %i\n", *pid, + PARA_DEBUG_LOG("child %i was killed by signal %i\n", (int)*pid, WTERMSIG(status)); else - PARA_WARNING_LOG("child %i terminated abormally\n", *pid); + PARA_WARNING_LOG("child %i terminated abormally\n", (int)*pid); return 1; } -- 2.39.5