summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2013-03-14 19:55:29 +1100
committerJeremy Allison <jra@samba.org>2013-03-15 10:38:25 -0700
commit346407443e6210da9c7335df7b898d96ff74c0e3 (patch)
treea4c9e7ef4c94d78cb6abeb85716be09d4d0a863f
parent29dfc94ca312523c5682235f642fb49030abd995 (diff)
downloadsamba-346407443e6210da9c7335df7b898d96ff74c0e3.tar.gz
samba-346407443e6210da9c7335df7b898d96ff74c0e3.tar.bz2
samba-346407443e6210da9c7335df7b898d96ff74c0e3.zip
ntdb: Cast getpid() result to unsigned int for GNU/Solaris build
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--lib/ntdb/lock.c6
-rw-r--r--lib/ntdb/tools/ntdbtorture.c12
2 files changed, 10 insertions, 8 deletions
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);
}