Fix compiler warning in the tests

pid_t might be a long, so let's format it as a long and cast it explicitly.
This commit is contained in:
Fabian Homborg
2020-02-12 19:20:40 +01:00
parent 21daf5c2f1
commit a6bd5fac0c

View File

@@ -48,12 +48,13 @@ static void print_stdout_stderr() {
}
static void print_pid_then_sleep() {
fprintf(stdout, "%d\n", getpid());
// On some systems getpid is a long, on others it's an int, let's just cast it.
fprintf(stdout, "%ld\n", (long)getpid());
fflush(nullptr);
usleep(1000000 / 2); //.5 secs
}
static void print_pgrp() { fprintf(stdout, "%d\n", getpgrp()); }
static void print_pgrp() { fprintf(stdout, "%ld\n", (long)getpgrp()); }
static void print_fds() {
bool needs_space = false;