ntdb: Cast getpid() result to unsigned int for GNU/Solaris build
authorAndrew Bartlett <abartlet@samba.org>
Thu, 14 Mar 2013 08:55:29 +0000 (19:55 +1100)
committerJeremy Allison <jra@samba.org>
Fri, 15 Mar 2013 17:38:25 +0000 (10:38 -0700)
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/ntdb/lock.c
lib/ntdb/tools/ntdbtorture.c

index 4517e2556857865c605dad7c50ef3b27c06385b6..71d6d8525b214fd34a42bd92c1ad6aa83308c466 100644 (file)
@@ -52,8 +52,10 @@ bool check_lock_pid(struct ntdb_context *ntdb, const char *call, bool log)
 
        if (log) {
                ntdb_logerr(ntdb, NTDB_ERR_LOCK, NTDB_LOG_USE_ERROR,
-                          "%s: fork() detected after lock acquisition!"
-                          " (%u vs %u)", call, ntdb->file->locker, getpid());
+                           "%s: fork() detected after lock acquisition!"
+                           " (%u vs %u)", call,
+                           (unsigned int)ntdb->file->locker,
+                           (unsigned int)getpid());
        }
        return false;
 }
index 717f5dd1f506dfb846c8fe964eded3af8d975ba6..3bcf3200f2c153c20acc04320e91d0ebd5763c96 100644 (file)
@@ -61,7 +61,7 @@ static void ntdb_log(struct ntdb_context *ntdb,
        {
                char str[200];
                signal(SIGUSR1, SIG_IGN);
-               sprintf(str,"xterm -e gdb /proc/%d/exe %d", getpid(), getpid());
+               sprintf(str,"xterm -e gdb /proc/%u/exe %u", (unsigned int)getpid(), (unsigned int)getpid());
                system(str);
        }
 #endif
@@ -74,7 +74,7 @@ static void segv_handler(int sig, siginfo_t *info, void *p)
        char string[100];
 
        sprintf(string, "%u: death at %p (map_ptr %p, map_size %zu)\n",
-               getpid(), info->si_addr, db->file->map_ptr,
+               (unsigned int)getpid(), info->si_addr, db->file->map_ptr,
                (size_t)db->file->map_size);
        if (write(2, string, strlen(string)) > 0)
                sleep(60);
@@ -85,7 +85,7 @@ static void warn_on_err(enum NTDB_ERROR e, struct ntdb_context *ntdb,
                        const char *why)
 {
        if (e != NTDB_SUCCESS) {
-               fprintf(stderr, "%u:%s:%s\n", getpid(), why,
+               fprintf(stderr, "%u:%s:%s\n", (unsigned int)getpid(), why,
                        ntdb ? ntdb_errorstr(e) : "(no ntdb)");
                error_count++;
        }
@@ -271,14 +271,14 @@ static int run_child(const char *filename, int i, int seed, unsigned num_loops,
        db = ntdb_open(filename, ntdb_flags, O_RDWR | O_CREAT, 0600,
                      &log_attr);
        if (!db) {
-               fprintf(stderr, "%u:%s:%s\n", getpid(), filename,
+               fprintf(stderr, "%u:%s:%s\n", (unsigned int)getpid(), filename,
                        "db open failed");
                exit(1);
        }
 
 #if 0
        if (i == 0) {
-               printf("pid %i\n", getpid());
+               printf("pid %u\n", (unsigned int)getpid());
                sleep(9);
        } else
                sleep(10);
@@ -527,7 +527,7 @@ done:
                db = ntdb_open(test_ntdb, NTDB_DEFAULT, O_RDWR | O_CREAT,
                              0600, &log_attr);
                if (!db) {
-                       fprintf(stderr, "%u:%s:%s\n", getpid(), test_ntdb,
+                       fprintf(stderr, "%u:%s:%s\n", (unsigned int)getpid(), test_ntdb,
                                "db open failed");
                        exit(1);
                }