]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (test_mkfds) fix the way to detect errors in fork(2)
authorMasatake YAMATO <yamato@redhat.com>
Wed, 18 Sep 2024 17:36:53 +0000 (02:36 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Wed, 18 Sep 2024 17:40:36 +0000 (02:40 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
tests/helpers/test_mkfds.c

index b7f120a2c8eefdacc42ddb4248b03904b1203853..7036eed6afbf7f8bc210ce7fcf47256ceaee7638 100644 (file)
@@ -2358,7 +2358,7 @@ static void *make_eventfd(const struct factory *factory _U_, struct fdesc fdescs
 
        signal(SIGCHLD, abort_with_child_death_message);
        *pid = fork();
-       if (*pid < -1) {
+       if (*pid < 0) {
                int e = errno;
                close(fdescs[0].fd);
                close(fdescs[1].fd);
@@ -2564,7 +2564,7 @@ static void *make_mqueue(const struct factory *factory, struct fdesc fdescs[],
 
        signal(SIGCHLD, abort_with_child_death_message);
        mqueue_data->pid = fork();
-       if (mqueue_data->pid < -1) {
+       if (mqueue_data->pid < 0) {
                int e = errno;
                mq_close(fdescs[0].fd);
                mq_close(fdescs[1].fd);