Explorar o código

Cast pid_t to int to avoid printf() format warning

Bryan Drewery %!s(int64=14) %!d(string=hai) anos
pai
achega
d46d02b5cd
Modificáronse 2 ficheiros con 6 adicións e 6 borrados
  1. 3 3
      src/conf.c
  2. 3 3
      src/main.c

+ 3 - 3
src/conf.c

@@ -63,7 +63,7 @@ tellconf()
              bot->net.host ? bot->net.host : "", bot->net.ip6 ? bot->net.ip6 : "", bot->net.host6 ? bot->net.host6 : "", 
              bot->net.v6,
              bot->hub,
-             bot->pid);
+             (int)bot->pid);
   }
   if (conf.bot && ((bot = conf.bot))) {
     sdprintf(STR("me:\n"));
@@ -74,7 +74,7 @@ tellconf()
              bot->net.host ? bot->net.host : "", bot->net.ip6 ? bot->net.ip6 : "", bot->net.host6 ? bot->net.host6 : "", 
              bot->net.v6,
              bot->hub,
-             bot->pid);
+             (int)bot->pid);
   }
 }
 
@@ -113,7 +113,7 @@ spawnbots(conf_bot *bots, bool rehashed)
      */
     } else if ((conf.bot && !strcasecmp(bot->nick, conf.bot->nick) &&
                (updating == UPDATE_AUTO || rehashed)) || (bot->pid && !updating)) {
-      sdprintf(STR(" ... skipping. Updating: %d, pid: %d"), updating, bot->pid);
+      sdprintf(STR(" ... skipping. Updating: %d, pid: %d"), updating, (int)bot->pid);
       continue;
     } else {
       /* if we are updating with -u then we need to restart ALL bots */

+ 3 - 3
src/main.c

@@ -770,14 +770,14 @@ int main(int argc, char **argv)
     if (settings.prefix[i] != SETTINGS_HEADER[0])
       werr(ERR_BADPASS);
 
-  sdprintf(STR("my euid: %d my uuid: %d, my ppid: %d my pid: %d"), myuid, getuid(), getppid(), mypid);
+  sdprintf(STR("my euid: %d my uuid: %d, my ppid: %d my pid: %d"), myuid, getuid(), (int)getppid(), (int)mypid);
 
   /* Check and load conf file */
   startup_checks(0);
 
   if (!socksfile && ((conf.bot->localhub && !updating) || !conf.bot->localhub)) {
     if ((conf.bot->pid > 0) && conf.bot->pid_file) {
-      sdprintf(STR("%s is already running, pid: %d"), conf.bot->nick, conf.bot->pid);
+      sdprintf(STR("%s is already running, pid: %d"), conf.bot->nick, (int)conf.bot->pid);
       exit(1);
     }
   }
@@ -825,7 +825,7 @@ int main(int argc, char **argv)
 
     printf(STR("%s[%s%s%s]%s -%s- initiated %s(%s%d%s)%s\n"),
            BOLD(-1), BOLD_END(-1), settings.packname, BOLD(-1), BOLD_END(-1), conf.bot->nick,
-           BOLD(-1), BOLD_END(-1), mypid, BOLD(-1), BOLD_END(-1));
+           BOLD(-1), BOLD_END(-1), (int)mypid, BOLD(-1), BOLD_END(-1));
 
     } else
       writepid(conf.bot->pid_file, mypid);