From: Rostislav Skudnov Date: Fri, 6 Oct 2017 08:19:46 +0000 (+0000) Subject: holetest: Use pid_t type for fork(2) return value X-Git-Tag: v2022.05.01~1842 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=cca45d1b9237f322c08dce59da630a788b893a12 holetest: Use pid_t type for fork(2) return value Signed-off-by: Rostislav Skudnov Reviewed-by: Christoph Hellwig Signed-off-by: Eryu Guan --- diff --git a/src/holetest.c b/src/holetest.c index 1939b35f..ab582f5f 100644 --- a/src/holetest.c +++ b/src/holetest.c @@ -199,22 +199,22 @@ int test_this(int fd, loff_t sz) tid[i] = (uint64_t)t[i]; printf("INFO: thread %d created\n", i); } else { + pid_t pid; /* * Flush stdout before fork, otherwise some lines get * duplicated... ?!?!? */ fflush(stdout); - tid[i] = fork(); - if (tid[i] < 0) { + pid = fork(); + if (pid < 0) { int j; perror("fork"); for (j = 0; j < i; j++) waitpid(tid[j], NULL, 0); exit(21); - } - /* Child? */ - if (!tid[i]) { + } else if (!pid) { + /* Child? */ void *ret; if (use_wr[i]) @@ -223,6 +223,7 @@ int test_this(int fd, loff_t sz) ret = pt_page_marker(&targs[i]); exit(ret ? 1 : 0); } + tid[i] = pid; printf("INFO: process %d created\n", i); } }