Browse Source

Cast pid_t to int to avoid printf() format warning

Bryan Drewery 14 years ago
parent
commit
69e09cedcd
3 changed files with 8 additions and 8 deletions
  1. 3 3
      src/conf.c
  2. 2 2
      src/debug.c
  3. 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 */

+ 2 - 2
src/debug.c

@@ -133,7 +133,7 @@ static void write_debug(bool fatal = 1)
     /* Write GDB backtrace */
     char gdb[1024] = "", btfile[256] = "", std_in[101] = "", *out = NULL;
 
-    simple_snprintf(btfile, sizeof(btfile), ".gdb-backtrace-%d", getpid());
+    simple_snprintf(btfile, sizeof(btfile), ".gdb-backtrace-%d", (int)getpid());
 
     FILE *f = fopen(btfile, "w");
 
@@ -142,7 +142,7 @@ static void write_debug(bool fatal = 1)
       //simple_snprintf(stdin, sizeof(stdin), "detach\n");
       //simple_snprintf(stdin, sizeof(stdin), "q\n");
 
-      simple_snprintf(gdb, sizeof(gdb), "gdb --pid=%d %s", getpid(), binname);
+      simple_snprintf(gdb, sizeof(gdb), "gdb --pid=%d %s", (int)getpid(), binname);
       shell_exec(gdb, std_in, &out, NULL);
       fprintf(f, "%s\n", out);
       fclose(f);

+ 3 - 3
src/main.c

@@ -794,14 +794,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);
     }
   }
@@ -849,7 +849,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);