From 346407443e6210da9c7335df7b898d96ff74c0e3 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 14 Mar 2013 19:55:29 +1100 Subject: ntdb: Cast getpid() result to unsigned int for GNU/Solaris build Reviewed-by: Jeremy Allison --- lib/ntdb/lock.c | 6 ++++-- lib/ntdb/tools/ntdbtorture.c | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'lib/ntdb') diff --git a/lib/ntdb/lock.c b/lib/ntdb/lock.c index 4517e25568..71d6d8525b 100644 --- a/lib/ntdb/lock.c +++ b/lib/ntdb/lock.c @@ -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; } diff --git a/lib/ntdb/tools/ntdbtorture.c b/lib/ntdb/tools/ntdbtorture.c index 717f5dd1f5..3bcf3200f2 100644 --- a/lib/ntdb/tools/ntdbtorture.c +++ b/lib/ntdb/tools/ntdbtorture.c @@ -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); } -- cgit