From patchwork Fri Nov 19 07:45:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=uumnPxK8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTJ63d8hz9sRK for ; Fri, 19 Nov 2021 18:46:30 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id C86AA3C89B2 for ; Fri, 19 Nov 2021 08:46:27 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 916C83C891E for ; Fri, 19 Nov 2021 08:46:14 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 009E5601404 for ; Fri, 19 Nov 2021 08:46:13 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id E9E8B9FD8F; Fri, 19 Nov 2021 07:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307973; bh=eyIp8tR1te44cf9Z1XM6ms51yrUt2ndYHZYmgPs7KSc=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=uumnPxK80wBf3kuBsjtM/q2dHpiHuJr1TKlFKIgc5wNeAUjw8+hou+rreVthxZI2a DyvFsBChfgk7bUG7BjMJEfXCKWS6TiKyFugLul7T6EsKyy54irn3VqOXbXfbSFjvZ9 erUy5+SXz0PotvLIknHNFZRXRweXcO1QQeJumF9E= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:45:51 +0100 Message-Id: <20211119074602.857595-2-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 01/12] posix/pthread_create/15-1: Supress warning X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow generate-makefiles.sh gave the following warning: conformance/interfaces/pthread_create/15-1.c should be test. The script has a strange implementation, that just greps for "main" in the c file. Based on that it decides if the file should be a test or a run-test. Other tests in the suite including the main-function from testfrmw/threads_scenarii.c also use a comment, that supresses the message Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/pthread_create/15-1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/15-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/15-1.c index e8c003fd4..a05db679b 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/15-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/15-1.c @@ -76,6 +76,7 @@ /*********************************** Test cases *****************************************/ /********************************************************************************************/ +/* main is defined in the next file */ #define STD_MAIN #include "../testfrmw/threads_scenarii.c" From patchwork Fri Nov 19 07:45:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=tfd8E5tI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTJH6Mqnz9sRK for ; Fri, 19 Nov 2021 18:46:39 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id AAB123C8989 for ; Fri, 19 Nov 2021 08:46:37 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id DD2623C7A4A for ; Fri, 19 Nov 2021 08:46:14 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 32285602129 for ; Fri, 19 Nov 2021 08:46:14 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id 585349FE1A; Fri, 19 Nov 2021 07:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307973; bh=0Z7I7oQi8+JmkSbZyKMpNPCmODMu0W6vYAAZnAvuDFc=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=tfd8E5tIy7cldHlWw3asw2RzP5Tc5H5MXgXMd+esaVLKvWoGeV9p9tnNXv06ZnVQX mqoLE4gTTEK0+5TEBzxNJInVnhqcHa1QHfXk5n7tDz3jsg7F78zF4sOiHnijd58PjD X8lLcCdq3EgUvCh0/ExJwfxCMuPAxXnlcKQhRc/c= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:45:52 +0100 Message-Id: <20211119074602.857595-3-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-2.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 02/12] posix/mq_(timed)send/5-1: Fix error reporting X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow In case mq_receive failed, the whole test could still return PASS/FAIL Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/mq_send/5-1.c | 3 +-- .../conformance/interfaces/mq_timedsend/5-1.c | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-1.c index a2b3025d4..174e4f69e 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-1.c @@ -68,7 +68,6 @@ int main(void) char msgrcd[BUFFER]; const char *msgptr = MSGSTR; struct mq_attr attr; - int unresolved = 0; unsigned pri; sprintf(gqname, "/mq_send_5-1_%d", getpid()); @@ -128,7 +127,7 @@ int main(void) /* receive one message and allow child's mq_send to complete */ if (mq_receive(gqueue, msgrcd, BUFFER, &pri) == -1) { perror("mq_receive() did not return success"); - unresolved = 1; + return cleanup_for_exit(gqueue, gqname, PTS_UNRESOLVED); } /* child has 5 seconds to call mq_send() again and notify us */ diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c index fb4a81fef..371cdbcd4 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c @@ -58,7 +58,6 @@ int main(void) char msgrcd[BUFFER]; const char *msgptr = MSGSTR; struct mq_attr attr; - int unresolved = 0; unsigned pri; sprintf(gqname, "/mq_timedsend_5-1_%d", getpid()); @@ -119,7 +118,10 @@ int main(void) /* receive message and allow blocked send to complete */ if (mq_receive(gqueue, msgrcd, BUFFER, &pri) == -1) { perror("mq_receive() did not return success"); - unresolved = 1; + kill(pid, SIGKILL); //kill child + mq_close(gqueue); + mq_unlink(gqname); + return PTS_UNRESOLVED; } if (sleep(3) == 0) { From patchwork Fri Nov 19 07:45:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=IuGYtAfo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTJg0DmTz9sRK for ; Fri, 19 Nov 2021 18:46:58 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id EF1FE3C89E5 for ; Fri, 19 Nov 2021 08:46:56 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id EBBE73C7A4A for ; Fri, 19 Nov 2021 08:46:15 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id A4E601A001C7 for ; Fri, 19 Nov 2021 08:46:14 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id DFED59FE82; Fri, 19 Nov 2021 07:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307974; bh=+Unq/U7kt5t38ObWqFYluZzLSRV7a11RZGARUiUCUyo=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=IuGYtAfoVX6wbsT145QWxEkhCwr30TwxjXdk7Xj8PecpsarC7Zwbau0ogGlmmJ4rW sDlZOZt62sMmAFG+MEaCwPhzXWhaPcji8HQ7/1SchB+0yiWpFV6HQgqnJIby+5VvC8 o6V37XGDzvVjpRlTf21U4mppMjKZm6Da8SHaoZws= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:45:53 +0100 Message-Id: <20211119074602.857595-4-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 03/12] posix/pthread_create/*: Remove unused variable X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow While pad was supposed to speed up stack growth, the test works without it and it was propably optimized out anyway. Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/pthread_create/1-5.c | 3 --- .../conformance/interfaces/pthread_create/3-2.c | 2 -- 2 files changed, 5 deletions(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-5.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-5.c index c4756ab6f..33c5b5cb6 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-5.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-5.c @@ -100,12 +100,9 @@ static void *overflow(void *arg) { void *current; - void *pad[50]; /* We want to consume the stack quickly */ long stacksize = sysconf(_SC_THREAD_STACK_MIN); /* make sure we touch the current stack memory */ int ret = 0; - pad[1] = NULL; /* so compiler stops complaining about unused variables */ - if (arg == NULL) { /* first call */ current = overflow(¤t); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c index a508fc45e..433ccd8fe 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c @@ -108,10 +108,8 @@ static sem_t semsync[2]; /* These semaphores will only be used in child process static void *overflow(void *arg) { void *current; - void *pad[50]; /* We want to consume the stack quickly */ long stacksize = sysconf(_SC_THREAD_STACK_MIN); /* make sure we touch the current stack memory */ - pad[1] = NULL; /* so compiler stops complaining about unused variables */ int ret = 0; if (arg == NULL) { From patchwork Fri Nov 19 07:45:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=RPomEiIG; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTJV19Hcz9sRK for ; Fri, 19 Nov 2021 18:46:50 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6437C3C8986 for ; Fri, 19 Nov 2021 08:46:47 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id EE7123C8982 for ; Fri, 19 Nov 2021 08:46:15 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 24EB4601404 for ; Fri, 19 Nov 2021 08:46:15 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id 4D6479FE97; Fri, 19 Nov 2021 07:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307974; bh=XmdKdKn+DTHy75XptMZC+yNE1ctIhBSsje2bwjJGuXM=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=RPomEiIGT7g/dybEMLygXEn7I8m42SdH0jr6Pv/Aaijbzmch0+anxzgCDqJZ2if1m 0sme2E87xI5kYEgcMuoqhUOF7X2aigVuy/NR4BEOdIXQ3rRlJGu7yVsxJqHR8as7Fv JBo559hl/u2OaIq08CnS8PXTKDImfYb+7N4cQLvg= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:45:54 +0100 Message-Id: <20211119074602.857595-5-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 04/12] posix/conformance/interfaces: Fix unsued-variable for testfrmw X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow Thre is a global variable sc in testfrmw/threads_scenarii, that is used, if the integrated main function (STD_MAIN) is used. However some tests did not use this integrated main, but still used the variable. To be able to get rid of all warnings, the variable is duplicated into these tests and only defined by threads_scenarii, if STD_MAIN is defined Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/pthread_create/14-1.c | 2 ++ .../conformance/interfaces/pthread_create/3-2.c | 2 ++ .../conformance/interfaces/pthread_detach/1-2.c | 2 ++ .../conformance/interfaces/pthread_detach/2-2.c | 1 + .../conformance/interfaces/pthread_detach/4-3.c | 1 + .../conformance/interfaces/pthread_exit/6-1.c | 1 + .../conformance/interfaces/pthread_join/1-2.c | 2 ++ .../conformance/interfaces/pthread_join/4-1.c | 1 + .../conformance/interfaces/pthread_join/6-3.c | 1 + .../conformance/interfaces/testfrmw/threads_scenarii.c | 4 ++-- 10 files changed, 15 insertions(+), 2 deletions(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/14-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/14-1.c index c21860ba8..84d229afc 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/14-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/14-1.c @@ -47,6 +47,8 @@ static volatile long sleep_time; /* number of pthread_create scenarios tested */ static unsigned long count_ope; +static unsigned int sc; + static unsigned long long current_time_usec(void) { struct timeval now; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c index 433ccd8fe..3197bdf67 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c @@ -104,6 +104,8 @@ static sem_t semsync[2]; /* These semaphores will only be used in child process! */ +static unsigned int sc; + /* The overflow function is used to test the stack overflow */ static void *overflow(void *arg) { diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-2.c index a6eb391ef..28a7e9ea9 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-2.c @@ -91,6 +91,8 @@ /*********************************** Real Test *****************************************/ /********************************************************************************************/ +static unsigned int sc; + static void *threaded(void *arg) { int ret = 0; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-2.c index 8a406fe44..a2c5cc657 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-2.c @@ -93,6 +93,7 @@ /********************************************************************************************/ static sem_t sem_sync; +static unsigned int sc; static void *threaded(void *arg) { diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c index fc3a50bef..126f5aa82 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c @@ -61,6 +61,7 @@ static sem_t semsig1; static unsigned long count_sig; static long sleep_time; static sigset_t usersigs; +static unsigned int sc; struct thestruct { int sig; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-1.c index b21e43d7b..639e508c2 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-1.c @@ -98,6 +98,7 @@ /* This will be used to control that atexit() has been called */ static int *ctl; static long mf; +static unsigned int sc; static void clnp(void) { diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/1-2.c index 34c410967..25e623fdb 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/1-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/1-2.c @@ -48,6 +48,8 @@ #include "../testfrmw/threads_scenarii.c" +static unsigned int sc; + static void *threaded(void *arg) { int ret = 0; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/4-1.c index b7bc56eac..6b19992ba 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/4-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/4-1.c @@ -46,6 +46,7 @@ #include "../testfrmw/threads_scenarii.c" static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; +static unsigned int sc; /* 1st thread function */ static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c index 7325defc3..ecf0498fa 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c @@ -56,6 +56,7 @@ static unsigned long count_sig; #endif static sigset_t usersigs; +static unsigned int sc; struct thestruct { int sig; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/threads_scenarii.c b/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/threads_scenarii.c index baf30a87c..645aff604 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/threads_scenarii.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/threads_scenarii.c @@ -482,10 +482,10 @@ static void scenar_fini(void) } } -static unsigned int sc; - #ifdef STD_MAIN +static unsigned int sc; + static void *threaded(void *arg); int main(void) From patchwork Fri Nov 19 07:45:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=jN1y0DwL; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTK21gtQz9sRN for ; Fri, 19 Nov 2021 18:47:18 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1FA7C3C8987 for ; Fri, 19 Nov 2021 08:47:16 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 40BCD3C89AF for ; Fri, 19 Nov 2021 08:46:16 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 0D9671000A48 for ; Fri, 19 Nov 2021 08:46:16 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id E14DB9F6A0; Fri, 19 Nov 2021 07:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307975; bh=J8HKqnhcOeTWBhrLbPDBMrW4UZrYs9xG6Hdx+yxQmDc=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=jN1y0DwLRFhj9/DhfmtOK5CUBcqT1thg8pCrH3ciJ5tubOUo5n/D06oLT4s4rzvsx v2T5gzvfAa0VyfsPqbJfGSRVYCLV+D+85CwgrAiNogFqnQwaNTZE4gFwumMQKaYpjd ptA5+lfJd4YtmFTg3uob4LtVDKQ9dMKXZs11fFUI= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:45:55 +0100 Message-Id: <20211119074602.857595-6-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 05/12] posix/conformance/interfaces: Fix all unused variable warnings X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow Either by marking them as unused or by removing them, if there is no sideffect. Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/aio_read/9-1.c | 3 +-- .../conformance/interfaces/aio_write/7-1.c | 3 +-- .../open_posix_testsuite/conformance/interfaces/fork/7-1.c | 2 +- .../conformance/interfaces/pthread_cond_init/2-1.c | 2 +- .../conformance/interfaces/pthread_exit/2-2.c | 2 +- .../conformance/interfaces/pthread_exit/3-2.c | 2 +- .../conformance/interfaces/pthread_mutex_init/3-1.c | 4 ++-- .../conformance/interfaces/pthread_mutex_timedlock/4-1.c | 4 +--- .../conformance/interfaces/pthread_mutex_timedlock/5-1.c | 4 +--- .../conformance/interfaces/pthread_mutex_timedlock/5-2.c | 4 +--- .../conformance/interfaces/pthread_mutex_timedlock/5-3.c | 4 +--- .../conformance/interfaces/pthread_mutex_trylock/4-3.c | 1 - .../conformance/interfaces/pthread_mutex_unlock/2-1.c | 4 ++-- .../conformance/interfaces/pthread_mutexattr_setpshared/1-1.c | 2 -- .../conformance/interfaces/pthread_once/4-1-buildonly.c | 3 ++- 15 files changed, 16 insertions(+), 28 deletions(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/9-1.c index e1ae59e3b..cd1aa0318 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/9-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/9-1.c @@ -48,7 +48,6 @@ int main(void) int i; struct aiocb aiocbs[NUM_AIOCBS]; int last_req; - int err; int ret; if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L @@ -85,7 +84,7 @@ int main(void) } for (i = 0; i < last_req - 1; i++) { - err = aio_error(&aiocbs[i]); + aio_error(&aiocbs[i]); ret = aio_return(&aiocbs[i]); } diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/7-1.c index 277573a38..52c8d7004 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/7-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/7-1.c @@ -48,7 +48,6 @@ int main(void) int i; struct aiocb aiocbs[NUM_AIOCBS]; int last_req; - int err; int ret; if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L @@ -79,7 +78,7 @@ int main(void) } for (i = 0; i < last_req - 1; i++) { - err = aio_error(&aiocbs[i]); + aio_error(&aiocbs[i]); ret = aio_return(&aiocbs[i]); } diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c index aaf1403f9..9a0b148d9 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c @@ -51,7 +51,7 @@ static void read_catalog(nl_catd cat, char *who) { - char *msg = NULL; + char *msg PTS_ATTRIBUTE_UNUSED = NULL; int i, j; #if VERBOSE > 0 diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_init/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_init/2-1.c index 4a60f7098..fbb7c68ff 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_init/2-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_init/2-1.c @@ -14,7 +14,7 @@ #include #include "posixtest.h" -static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_cond_t cond PTS_ATTRIBUTE_UNUSED = PTHREAD_COND_INITIALIZER; int main(void) { diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c index 2fc3ff700..16c658f73 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c @@ -92,7 +92,7 @@ static int global = 0; static int tab[3]; -#define CLEANUP(n) static void clnp##n(void * arg)\ +#define CLEANUP(n) static void clnp##n(void * arg PTS_ATTRIBUTE_UNUSED)\ {\ tab[global]=n; \ global++; \ diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c index 5fa6c8b50..4437ffc77 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c @@ -94,7 +94,7 @@ static int global = 0; static int tab[4]; static pthread_key_t tld[3]; -#define CLEANUP(n) static void clnp##n(void * arg)\ +#define CLEANUP(n) static void clnp##n(void * arg PTS_ATTRIBUTE_UNUSED)\ {\ tab[global]=n; \ global++; \ diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-1.c index 9ee86a5db..8a9b989f1 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-1.c @@ -5,7 +5,7 @@ * of this license, see the COPYING file at the top level of this * source tree. - * Test that the macro PTHREAD_MUTEX_INITIALIZER can be sued to intiailize + * Test that the macro PTHREAD_MUTEX_INITIALIZER can be used to initialize * mutexes that are statically allocated. * */ @@ -20,7 +20,7 @@ typedef struct my_data { int value; /* Access protected by mutex */ } my_data_t; -static my_data_t data = { PTHREAD_MUTEX_INITIALIZER, 0 }; +static my_data_t data PTS_ATTRIBUTE_UNUSED = { PTHREAD_MUTEX_INITIALIZER, 0 }; int main(void) { diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c index a7099688b..d3c0bdae9 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c @@ -32,9 +32,7 @@ static void *f1(void *parm); static int ret; /* Save return value of pthread_mutex_timedlock(). */ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -static time_t currsec1, currsec2; /* Variables for saving time before - and afer locking the mutex using - pthread_mutex_timedlock(). */ + /**************************** * * MAIN() diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c index 077bfe76d..f51106bdf 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c @@ -40,9 +40,7 @@ static void *f1(void *parm); static int ret; /* Save return value of pthread_mutex_timedlock(). */ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -static time_t currsec1, currsec2; /* Variables for saving time before - and afer locking the mutex using - pthread_mutex_timedlock(). */ + /**************************** * * MAIN() diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c index 0eda6e58f..afca84eed 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c @@ -40,9 +40,7 @@ static void *f1(void *parm); static int ret; /* Save return value of pthread_mutex_timedlock(). */ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -static time_t currsec1, currsec2; /* Variables for saving time before - and afer locking the mutex using - pthread_mutex_timedlock(). */ + /**************************** * * MAIN() diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c index baf429503..a5f8b3383 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c @@ -36,9 +36,7 @@ static void *f1(void *parm); static int ret; /* Save return value of pthread_mutex_timedlock(). */ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -static time_t currsec1, currsec2; /* Variables for saving time before - and afer locking the mutex using - pthread_mutex_timedlock(). */ + /**************************** * * MAIN() diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c index e7e86bfa8..2145bde8a 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c @@ -103,7 +103,6 @@ static struct _scenar { #define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0])) static char do_it = 1; -static char woken = 0; static unsigned long count_ope = 0; #ifdef WITH_SYNCHRO static sem_t semsig1; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c index 27f0ee3d7..39dacb73e 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c @@ -39,13 +39,13 @@ static int value; /* value protected by mutex */ int main(void) { - int i, rc; + int i; pthread_t threads[THREAD_NUM]; /* Create threads */ fprintf(stderr, "Creating %d threads\n", THREAD_NUM); for (i = 0; i < THREAD_NUM; ++i) - rc = pthread_create(&threads[i], NULL, func, NULL); + pthread_create(&threads[i], NULL, func, NULL); /* Wait to join all threads */ for (i = 0; i < THREAD_NUM; ++i) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c index 909b53bf4..8e8617bbd 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c @@ -37,8 +37,6 @@ #include #include "posixtest.h" -static pthread_mutex_t new_mutex; /* The mutex. */ - int main(void) { pthread_mutexattr_t mta; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/4-1-buildonly.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/4-1-buildonly.c index 6e519962b..d3392f908 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/4-1-buildonly.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/4-1-buildonly.c @@ -11,5 +11,6 @@ */ #include +#include "posixtest.h" -static pthread_once_t dummy = PTHREAD_ONCE_INIT; +static pthread_once_t dummy PTS_ATTRIBUTE_UNUSED = PTHREAD_ONCE_INIT; From patchwork Fri Nov 19 07:45:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556959 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=XMBNkWV/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTJs42Vxz9sRK for ; Fri, 19 Nov 2021 18:47:09 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id E11653C89B9 for ; Fri, 19 Nov 2021 08:47:06 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 1C9203C89AD for ; Fri, 19 Nov 2021 08:46:17 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 920AF6013F9 for ; Fri, 19 Nov 2021 08:46:16 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id B0F749FD8F; Fri, 19 Nov 2021 07:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307975; bh=yAzCtyod/ehTgwPpHhmHbPU8mhf8NditqDPTnq0WiO8=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=XMBNkWV/JwJEnI5gS+78s3NSCvKwmH9ZnkNFouNGZuAeElTZcBDy+5eWv1SGyFyvv U9oDsPQnrfBvFBW8fLfebjUhXzvmtq5bh9PbsH2iuaIj3SWOVOgKHbv4AEcsCT5fF9 jvUi1vVS9nmtkM1SlNTkM/PGdNHJQbZfnRGziTIw= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:45:56 +0100 Message-Id: <20211119074602.857595-7-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 06/12] posix/conformance/interfaces: Fix all unused function warnings X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/pthread_attr_setstack/6-1.c | 6 ------ .../conformance/interfaces/pthread_attr_setstack/7-1.c | 6 ------ .../interfaces/pthread_attr_setstacksize/4-1.c | 6 ------ .../conformance/interfaces/pthread_exit/4-1.c | 9 ++------- .../conformance/interfaces/pthread_exit/5-1.c | 7 +------ .../conformance/interfaces/pthread_kill/8-1.c | 8 -------- .../conformance/interfaces/pthread_mutex_lock/1-1.c | 4 ++-- .../conformance/interfaces/pthread_sigmask/18-1.c | 8 -------- 8 files changed, 5 insertions(+), 49 deletions(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/6-1.c index 5eac212f9..d298c30ec 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/6-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/6-1.c @@ -31,12 +31,6 @@ static void *stack_addr; static size_t stack_size; -static void *thread_func() -{ - pthread_exit(0); - return NULL; -} - int main(void) { pthread_attr_t attr; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/7-1.c index bc7f4f415..932fa8200 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/7-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/7-1.c @@ -32,12 +32,6 @@ static void *stack_addr; static size_t stack_size; -static void *thread_func() -{ - pthread_exit(0); - return NULL; -} - int main(void) { pthread_attr_t attr; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c index b229d7052..800913a66 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c @@ -28,12 +28,6 @@ #define STACKSIZE PTHREAD_STACK_MIN - sysconf(_SC_PAGE_SIZE) -static void *thread_func() -{ - pthread_exit(0); - return NULL; -} - int main(void) { pthread_attr_t attr; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c index 1252d5619..810df0c34 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c @@ -91,12 +91,7 @@ static int global = 0; -/* atexit() routines */ -static void at1(void) -{ - global +=1; -} - +/* atexit() routine */ static void at2(void) { global +=2; @@ -107,7 +102,7 @@ static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED) { int ret = 0; - /* Note that this funtion will be registered once again for each scenario. + /* Note that this function will be registered once again for each scenario. POSIX requires the ability to register at least 32 functions so it should not be an issue in our case, as long as we don't get more than 32 scenarii (with joinable threads) */ diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c index 730b751eb..69d5c6a97 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c @@ -91,12 +91,7 @@ static int atctl = 0; static pthread_key_t tld[3]; -/* atexit() routines */ -static void at1(void) -{ - atctl += 1; -} - +/* atexit() routine */ static void at2(void) { atctl += 2; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c index 086a0cf5c..b61a08173 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c @@ -153,14 +153,6 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED) #endif } -static int init_ctl; -/* Init function */ -static void initializer(void) -{ - init_ctl++; - return; -} - /* Test function -- calls pthread_kill() and checks that EINTR is never returned. */ static void *test(void *arg PTS_ATTRIBUTE_UNUSED) { diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/1-1.c index 913251914..4fccbfdf4 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/1-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/1-1.c @@ -36,7 +36,7 @@ static int value; /* value protected by mutex */ int main(void) { - int i, rc; + int i; pthread_attr_t pta; pthread_t threads[THREAD_NUM]; //pthread_t self = pthread_self(); @@ -47,7 +47,7 @@ int main(void) /* Create threads */ fprintf(stderr, "Creating %d threads\n", THREAD_NUM); for (i = 0; i < THREAD_NUM; ++i) - rc = pthread_create(&threads[i], &pta, f1, NULL); + pthread_create(&threads[i], &pta, f1, NULL); /* Wait to join all threads */ for (i = 0; i < THREAD_NUM; ++i) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c index 81ba4ea9b..5801e0e60 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c @@ -153,14 +153,6 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED) #endif } -static int init_ctl; -/* Init function */ -static void initializer(void) -{ - init_ctl++; - return; -} - /* Test function -- calls pthread_sigmask() and checks that EINTR is never returned. */ static void *test(void *arg PTS_ATTRIBUTE_UNUSED) { From patchwork Fri Nov 19 07:45:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556961 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=JbxDrVdM; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTKC6NYfz9sRK for ; Fri, 19 Nov 2021 18:47:27 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id C51093C8986 for ; Fri, 19 Nov 2021 08:47:25 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 4CB033C89B1 for ; Fri, 19 Nov 2021 08:46:17 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id E04501A0119D for ; Fri, 19 Nov 2021 08:46:16 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id 47C1F9FE1A; Fri, 19 Nov 2021 07:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307976; bh=WfDQxebY2h5LCLWPZK3snL0UxSmBDwAbDJ/4glAmXMU=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=JbxDrVdM6QzWFwOKUVsY6CAku4V4AiYVrcfziu8IkdrK3wpUKZ8xGdLGihYV/ZPm1 /1xDtUc6D+/5+zMulYyonX8/9OxdTSuPYiac0FcT9kf7cTe6uRwZCAiRra+3lW/QRR Qx4Xe9P1y+n4D/M6F7jMHq/jxf6OyjH158ItUGMA= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:45:57 +0100 Message-Id: <20211119074602.857595-8-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 07/12] posix/pthread_key_create/2-1: Remove invalid part of test X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow The first step accroding to the test description is: "Create a key", but the code was "get the value for an unitialized key". This was undefined behavior. Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/pthread_key_create/2-1.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/2-1.c index f150f3443..51c89f376 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/2-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/2-1.c @@ -28,13 +28,6 @@ int main(void) pthread_key_t key; void *rc; - /* Verify that the value associated with "key" in a new thread is NULL */ - rc = pthread_getspecific(key); - if (rc != NULL) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (pthread_key_create(&key, NULL) != 0) { printf("Error: pthread_key_create() failed\n"); return PTS_UNRESOLVED; From patchwork Fri Nov 19 07:45:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556962 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=N9RvplYr; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTKQ2vNvz9sRK for ; Fri, 19 Nov 2021 18:47:38 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id CF69D3C89C1 for ; Fri, 19 Nov 2021 08:47:35 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id C22143C89B4 for ; Fri, 19 Nov 2021 08:46:17 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 66E821001127 for ; Fri, 19 Nov 2021 08:46:17 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id A1AD09FE82; Fri, 19 Nov 2021 07:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307976; bh=8Z1qcAfGOzyI9lBIYRbkUsl1DEG9Sr7OBJMDniXZFeA=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=N9RvplYrCj314FWQ5woPoUkX3X++GPRBT0riqh8lIu6fcv3q1bwfcb5tZyP5BF6Aa IIuFXtM6jvKFrSyVxYzdIKvpUBmn+6A9uV/4AfiYCxp4LEl6ph3IfsOmrApb2wg5FQ YAiWJucpHElaFhc4/R59F29Y8UPD8vYIWYhwTfno= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:45:58 +0100 Message-Id: <20211119074602.857595-9-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 08/12] posix/asctime: Fix potentioal buffer overflow X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow The buffer used in the sprintf was too small and could overflow. Signed-off-by: Joerg Vehlow --- .../open_posix_testsuite/conformance/interfaces/asctime/1-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/asctime/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/asctime/1-1.c index bc3095081..8463d953d 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/asctime/1-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/asctime/1-1.c @@ -28,7 +28,7 @@ int main(void) { struct tm time_ptr; - char expected[26]; + char expected[128]; char *real; char wday_name[7][3] = From patchwork Fri Nov 19 07:45:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556964 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=K4U+IkBo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTKb2Byvz9sRK for ; Fri, 19 Nov 2021 18:47:47 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 175BC3C8987 for ; Fri, 19 Nov 2021 08:47:45 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 44C3A3C89AF for ; Fri, 19 Nov 2021 08:46:18 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id D22D21A0149E for ; Fri, 19 Nov 2021 08:46:17 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id 262A29F6A0; Fri, 19 Nov 2021 07:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307977; bh=izi3kpVW5OxO49WRtTMAcgCVn/LaC7+txiEie9uqcm4=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=K4U+IkBovUfez2FJXntopq7a7Po6DBMNyZ76dUu+jG/MRZGuF1s8oKQfFmFbu4AlP fHZpj1E+OmCKQh8V225XtASgFl+gKwXOXXF5At4UfJHMP012U6xp/O4GJEGByoKcZl oWPqzp66fo4CmOHOSTtwbGG1j6IJCciHnSqP5kIc= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:45:59 +0100 Message-Id: <20211119074602.857595-10-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 09/12] posix/conformance/interfaces/pthread_*_destroy: Suppress nonnull warning X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow These two tests are specifically testing passing NULL to the functions, so we supress the error message at least for gcc. Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/pthread_condattr_destroy/4-1.c | 3 +++ .../conformance/interfaces/pthread_mutexattr_destroy/4-1.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_condattr_destroy/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_condattr_destroy/4-1.c index d0aa32f8a..6205d8d29 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_condattr_destroy/4-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_condattr_destroy/4-1.c @@ -15,6 +15,9 @@ * */ +/* This test explicitly tries to pass null to a parameter, that should not be NULL */ +#pragma GCC diagnostic ignored "-Wnonnull" + #include #include #include diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_destroy/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_destroy/4-1.c index 094739030..cad698012 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_destroy/4-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_destroy/4-1.c @@ -15,6 +15,9 @@ * */ +/* This test explicitly tries to pass null to a parameter, that should not be NULL */ +#pragma GCC diagnostic ignored "-Wnonnull" + #include #include #include From patchwork Fri Nov 19 07:46:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556965 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=eXV5NYAw; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTKp082Tz9sRN for ; Fri, 19 Nov 2021 18:47:57 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 042613C8A0C for ; Fri, 19 Nov 2021 08:47:56 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id F0FDE3C7A4A for ; Fri, 19 Nov 2021 08:46:18 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 5BF1C1001127 for ; Fri, 19 Nov 2021 08:46:18 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id 9776A9FD8F; Fri, 19 Nov 2021 07:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307977; bh=XSI3HVZi7KPyevHoKGRBVPiMA/25HPUbnvs1Qt5SJtk=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=eXV5NYAwR+8oPKQBc9zp7f64ttLYhEujbbRC55ngWRwUo7wRN7FY0KH8uPhkd3Tcv NbhxHwcIfmP0IJt3N5WHvMD+ILAnSK5l5JDA2ayfIXhfkYTQfJdLTJEfN7U7GwBlFm ZQ6i9GJARB7uRmHH4vAEmXJiKaVf1AB0BWPUzvgU= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:46:00 +0100 Message-Id: <20211119074602.857595-11-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 10/12] posix/conformance/interfaces: Fix all sign-compare warnings X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/pthread_exit/1-2.c | 2 +- .../conformance/interfaces/pthread_exit/2-2.c | 3 ++- .../conformance/interfaces/pthread_exit/3-2.c | 3 ++- .../conformance/interfaces/pthread_exit/4-1.c | 2 +- .../conformance/interfaces/pthread_exit/5-1.c | 3 ++- .../conformance/interfaces/pthread_mutex_trylock/1-2.c | 2 +- .../conformance/interfaces/pthread_mutex_trylock/2-1.c | 2 +- .../conformance/interfaces/pthread_sigmask/18-1.c | 2 +- .../conformance/interfaces/pthread_sigmask/7-1.c | 3 ++- 9 files changed, 13 insertions(+), 9 deletions(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-2.c index 82be6f982..c9931e295 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-2.c @@ -105,7 +105,7 @@ int main(void) int ret = 0; void *rval; pthread_t child; - int i; + unsigned int i; output_init(); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c index 16c658f73..7098e2e5d 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c @@ -123,7 +123,8 @@ int main(void) int ret = 0; void *rval; pthread_t child; - int i, j; + unsigned int i; + int j; output_init(); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c index 4437ffc77..0a8583fad 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c @@ -149,7 +149,8 @@ int main(void) int ret = 0; void *rval; pthread_t child; - int i, j; + unsigned int i; + int j; output_init(); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c index 810df0c34..33e5562ca 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c @@ -122,7 +122,7 @@ int main(void) int ret = 0; void *rval; pthread_t child; - int i; + unsigned int i; output_init(); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c index 69d5c6a97..e35dbef99 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c @@ -141,7 +141,8 @@ int main(void) int ctl = 0; void *rval; pthread_t child; - int i, j; + unsigned int i; + int j; output_init(); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c index 7901115f0..a3d8c4864 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c @@ -149,7 +149,7 @@ static void *tf(void *arg) int main(void) { int ret; - int sc; + unsigned int sc; pthread_mutexattr_t ma; testdata_t *td; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c index 203d03cb5..038cf94f0 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c @@ -126,7 +126,7 @@ static void *tf(void *arg) int main(void) { int ret; - int sc; + unsigned int sc; pthread_mutexattr_t ma; testdata_t *td; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c index 5801e0e60..f303e9854 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c @@ -158,7 +158,7 @@ static void *test(void *arg PTS_ATTRIBUTE_UNUSED) { int ret = 0; sigset_t set; - int i, j = 0; + unsigned int i, j = 0; int signals[] = { SIGBUS, SIGKILL, SIGABRT, SIGCHLD, SIGHUP }; #define NSIG (sizeof(signals)/sizeof(int)) int operation[] = { SIG_SETMASK, SIG_BLOCK, SIG_UNBLOCK }; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c index aa9c6b96e..79cdefd99 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c @@ -24,7 +24,8 @@ returned by the pthread_sigmask functions. static void *a_thread_func() { sigset_t oactl, tempset; - int i, j, test_failed = 0; + unsigned int i, j; + int test_failed = 0; int siglist[] = { SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, From patchwork Fri Nov 19 07:46:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556966 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=e4hczBpD; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTL21lrhz9sRK for ; Fri, 19 Nov 2021 18:48:10 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B96D13C89B6 for ; Fri, 19 Nov 2021 08:48:07 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 2A4333C89FD for ; Fri, 19 Nov 2021 08:46:19 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id D2E986013F9 for ; Fri, 19 Nov 2021 08:46:18 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id 2282A9FE1A; Fri, 19 Nov 2021 07:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307978; bh=I8uMNpNKdwdfAcbqM2k7EQ/Ev67xw0zJqSHYd6Yq4OA=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=e4hczBpDdxREN/bRxI+szvpYFfMPW33nVqeAbdv+cs5gAqQZ1lU8IuWzgBeLE29t+ YUruO289Nw9sMWc2ptumPpujpB0rYzEzRs16YlbZVlMNMq5W8HpoSCqtE6ACuFr621 ++a2cE2edxPxC31UPyxI2xhYbTsqxaW8pBu6kJCA= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:46:01 +0100 Message-Id: <20211119074602.857595-12-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 11/12] posix/conformance/interface/mmap/5-1: Remove invalid static X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow A storage class specifier for a struct definition has no effect Signed-off-by: Joerg Vehlow --- .../open_posix_testsuite/conformance/interfaces/mmap/5-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/5-1.c index bcb330da6..ad7b6bb2d 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/5-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/5-1.c @@ -34,7 +34,7 @@ #include "posixtest.h" #include "tempfile.h" -static struct testcase { +struct testcase { int prot; int flags; }; From patchwork Fri Nov 19 07:46:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Vehlow X-Patchwork-Id: 1556967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=jv-coder.de header.i=@jv-coder.de header.a=rsa-sha256 header.s=dkim header.b=n4yiKN3u; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwTLC6H4bz9sRK for ; Fri, 19 Nov 2021 18:48:19 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6AB7F3C89A0 for ; Fri, 19 Nov 2021 08:48:17 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 3690F3C898B for ; Fri, 19 Nov 2021 08:46:23 +0100 (CET) Received: from mail.jv-coder.de (mail.jv-coder.de [5.9.79.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id C73862011DF for ; Fri, 19 Nov 2021 08:46:20 +0100 (CET) Received: from ubuntu.localdomain (unknown [188.195.115.12]) by mail.jv-coder.de (Postfix) with ESMTPSA id 9774B9F6A0; Fri, 19 Nov 2021 07:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jv-coder.de; s=dkim; t=1637307978; bh=xvfAN4IYgg+K6clV9HffYVabEwvmh6W1EDD5t/aXtYY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=n4yiKN3uVhEKlaHdbZhRJEmAq4VdxQKG0n6RAdJB2xlPZ7SXPyl04v0+LXnko6e5q UarnpKvCetKLJcmPxrGidrdVEhHIrweFKLU6bpsDtytGFhmzD3PLbTyPTGqr7n1LFB k4NxwRS8JOqv6UBAIRvf4rpzoXQc+dE4e+GJzXsM= From: Joerg Vehlow To: ltp@lists.linux.it Date: Fri, 19 Nov 2021 08:46:02 +0100 Message-Id: <20211119074602.857595-13-lkml@jv-coder.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119074602.857595-1-lkml@jv-coder.de> References: <20211119074602.857595-1-lkml@jv-coder.de> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-7.smtp.seeweb.it X-Virus-Scanned: clamav-milter 0.102.4 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 12/12] posix/interface/conformance: Fix/supress all unused-result warnings X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joerg Vehlow Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Joerg Vehlow The warnings for writes in signalhandlers can only be suppressed, there is no good way to handle an error there. In all other locations a failing function is printed and PTS_UNRESOLVED returned. Signed-off-by: Joerg Vehlow --- .../conformance/interfaces/clock_getcpuclockid/5-1.c | 10 ++++++++-- .../conformance/interfaces/fork/7-1.c | 3 ++- .../conformance/interfaces/kill/2-2.c | 5 ++++- .../conformance/interfaces/kill/3-1.c | 5 ++++- .../conformance/interfaces/mmap/11-2.c | 5 +++++ .../conformance/interfaces/mmap/11-3.c | 5 +++++ .../conformance/interfaces/mmap/18-1.c | 6 +++++- .../conformance/interfaces/mq_open/16-1.c | 8 ++++++-- .../conformance/interfaces/pthread_create/1-3.c | 11 +++++++++-- .../conformance/interfaces/sched_setparam/2-1.c | 5 ++++- .../conformance/interfaces/sched_setparam/2-2.c | 5 ++++- .../conformance/interfaces/sched_yield/1-1.c | 9 ++++++--- .../conformance/interfaces/shm_open/26-2.c | 9 ++++++--- .../conformance/interfaces/shm_unlink/8-1.c | 3 ++- .../conformance/interfaces/shm_unlink/9-1.c | 6 ++++-- .../conformance/interfaces/sigaction/19-1.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-10.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-11.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-12.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-13.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-14.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-15.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-16.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-17.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-18.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-19.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-2.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-20.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-21.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-22.c | 8 ++++++-- .../conformance/interfaces/sigaction/19-23.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-24.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-25.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-26.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-3.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-4.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-5.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-6.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-7.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-8.c | 9 +++++++-- .../conformance/interfaces/sigaction/19-9.c | 9 +++++++-- .../conformance/interfaces/sigaltstack/9-1.c | 5 ++++- testcases/open_posix_testsuite/include/affinity.h | 3 ++- 43 files changed, 261 insertions(+), 75 deletions(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/5-1.c index 0046d5066..2e9961a19 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/5-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/5-1.c @@ -35,8 +35,14 @@ int main(void) pwd = getpwnam("nobody"); if (pwd != NULL) { - setgid(pwd->pw_gid); - setuid(pwd->pw_uid); + if (setgid(pwd->pw_gid)) { + perror("setgid"); + return PTS_UNRESOLVED; + } + if (setuid(pwd->pw_uid)) { + perror("setuid"); + return PTS_UNRESOLVED; + } } } diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c index 9a0b148d9..46350b7f0 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c @@ -157,7 +157,8 @@ int main(void) if (ret != 0) UNRESOLVED(errno, "Failed to close the message catalog"); - system("rm -f " MESSCAT_IN " " MESSCAT_OUT); + unlink(MESSCAT_IN); + unlink(MESSCAT_OUT); #if VERBOSE > 0 output("Test passed\n"); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/kill/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/kill/2-2.c index dd566831c..1cd3b2fdc 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/kill/2-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/kill/2-2.c @@ -55,7 +55,10 @@ int main(void) */ /* this is added incase user is root. If user is normal user, then it * has no effect on the tests */ - setuid(1); + if (setuid(1)) { + perror("setuid"); + return PTS_UNRESOLVED; + } if (-1 == kill(1, 0)) { if (EPERM == errno) { diff --git a/testcases/open_posix_testsuite/conformance/interfaces/kill/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/kill/3-1.c index a5999332b..70a8c590c 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/kill/3-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/kill/3-1.c @@ -23,7 +23,10 @@ int main(void) { /* this is added incase user is root. If user is normal user, then it * has no effect on the tests */ - setuid(1); + if (setuid(1)) { + perror("setuid"); + return PTS_UNRESOLVED; + } if (kill(1, 0) != -1) { printf diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c index d63949418..27bfec8ca 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c @@ -33,6 +33,9 @@ #include "posixtest.h" #include "tempfile.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + #define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) static void sigbus_handler(int signum) @@ -44,6 +47,8 @@ static void sigbus_handler(int signum) } } +#pragma GCC diagnostic pop + int main(void) { #ifndef _POSIX_MEMORY_PROTECTION diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-3.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-3.c index 073b64ef9..704049290 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-3.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-3.c @@ -31,6 +31,9 @@ #include #include "posixtest.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + #define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) static void sigbus_handler(int signum) @@ -42,6 +45,8 @@ static void sigbus_handler(int signum) } } +#pragma GCC diagnostic pop + int main(void) { #ifndef _POSIX_MEMORY_PROTECTION diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c index 113d01b8c..02fc73d80 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c @@ -131,7 +131,11 @@ int main(void) printf("Got EAGAIN: %s\n", strerror(errno)); printf("Test PASSED\n"); /* Change user to root */ - seteuid(0); + if (seteuid(0)) { + close(fd); + perror("seteuid"); + return PTS_UNRESOLVED; + } close(fd); munmap(pa, len); return PTS_PASS; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/16-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/16-1.c index eee55a748..ecbfb0f79 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/16-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/16-1.c @@ -61,10 +61,14 @@ int main(void) printf(TNAME " Error at open(): %s\n", strerror(errno)); return PTS_UNRESOLVED; } - /* file is empty now, will cause "Bus error" */ - write(fd, fname, sizeof(int)); unlink(fname); + if (ftruncate(fd, sizeof(int))) { + perror("ftruncate"); + close(fd); + return PTS_UNRESOLVED; + } + pa = mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (pa == MAP_FAILED) { printf(TNAME " Error at mmap: %s\n", strerror(errno)); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-3.c index 30fcfe0e9..d24810dce 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-3.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-3.c @@ -10,8 +10,8 @@ * * Steps: * 1. Create a new thread that will go into a never-ending while loop. - * 2. If the thread is truly asynchronise, then the main function will - * continue instead of waiting for the thread to return (which in never + * 2. If the thread is truly asynchronous, then the main function will + * continue instead of waiting for the thread to return (which it never * does in this test case). * 3. An alarm is set to go off (i.e. send the SIGARLM signal) after 3 * seconds. This is done for 'timeing-out' reasons, in case main DOES @@ -30,6 +30,8 @@ static void *a_thread_function(); static void alarm_handler(); +static volatile int alarm_triggered; + static pthread_t a; int main(void) @@ -72,6 +74,9 @@ static void *a_thread_function() return NULL; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + #define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) /* If this handler is called, that means that the test has failed. */ @@ -80,3 +85,5 @@ static void alarm_handler() WRITE("Test FAILED: Alarm fired while waiting for cancelation\n"); _exit(PTS_FAIL); } + +#pragma GCC diagnostic pop diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c index da56343d0..fb19ff6a4 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c @@ -125,7 +125,10 @@ int main(void) return PTS_UNRESOLVED; } - pipe(the_pipe); + if (pipe(the_pipe)) { + perror("pipe"); + return PTS_UNRESOLVED; + } for (i = 0; i < nb_child; i++) { child_pid[i] = fork(); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c index 6f10618b6..6c68120c3 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c @@ -129,7 +129,10 @@ int main(void) return PTS_UNRESOLVED; } - pipe(the_pipe); + if (pipe(the_pipe)) { + perror("pipe"); + return PTS_UNRESOLVED; + } for (i = 0; i < nb_child; i++) { child_pid[i] = fork(); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_yield/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_yield/1-1.c index 602733e60..2e1e3197a 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sched_yield/1-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_yield/1-1.c @@ -45,18 +45,21 @@ static int child_busy(int fd) alarm(4); /* Tell the parent we're ready */ - write(fd, "go", 2); + if (write(fd, "go", 2) == -1) { + perror("write"); + exit(PTS_UNRESOLVED); + } for (;;) { rc = sched_yield(); if (rc) { ERR_LOG("child: sched_yield", rc); - exit(1); + exit(PTS_FAIL); } } /* should not get here */ - exit(2); + exit(PTS_UNRESOLVED); } int main(void) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/26-2.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/26-2.c index 215d3e1af..69edeae85 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/26-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/26-2.c @@ -95,19 +95,22 @@ int main(void) fd = shm_open(SHM_NAME, O_RDWR | O_TRUNC, 0); if (fd == -1) { perror("An error occurs when calling shm_open()"); - seteuid(getuid()); + if (seteuid(getuid())) + perror("seteuid"); shm_unlink(SHM_NAME); return PTS_UNRESOLVED; } if (fstat(fd, &stat_buf) != 0) { perror("An error occurs when calling fstat()"); - seteuid(getuid()); + if (seteuid(getuid())) + perror("seteuid"); shm_unlink(SHM_NAME); return PTS_UNRESOLVED; } - seteuid(getuid()); + if (seteuid(getuid())) + perror("seteuid"); shm_unlink(SHM_NAME); if (stat_buf.st_uid == old_uid && stat_buf.st_gid == old_gid) { diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/8-1.c index ed18cf213..d67d2fbe2 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/8-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/8-1.c @@ -86,7 +86,8 @@ int main(void) return PTS_UNRESOLVED; } - seteuid(getuid()); + if (seteuid(getuid())) + perror("seteuid"); if (fstat(fd, &stat_after) != 0) { perror("An error occurs when calling fstat()"); diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/9-1.c index 5c52465c8..9ef4b0c65 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/9-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/9-1.c @@ -69,12 +69,14 @@ int main(void) result = shm_unlink(SHM_NAME); if (result == -1 && errno == EACCES) { printf("Test PASSED\n"); - seteuid(getuid()); + if (seteuid(getuid())) + perror("seteuid"); shm_unlink(SHM_NAME); return PTS_PASS; } else if (result == -1) { perror("Unexpected error"); - seteuid(getuid()); + if (seteuid(getuid())) + perror("seteuid"); shm_unlink(SHM_NAME); return PTS_FAIL; } diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-1.c index a038ea92a..98b7e2e9d 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-1.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-10.c index 019c98036..649a6914f 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-10.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-10.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-11.c index 7e3545e90..e8223fb4b 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-11.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-11.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-12.c index 123ff169d..9b46baaf0 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-12.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-12.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-13.c index 6cfe1d7f9..944741014 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-13.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-13.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-14.c index 9371b1bdb..3c1aa1f48 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-14.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-14.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-15.c index 37a986d68..803851648 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-15.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-15.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-16.c index 72446e792..e189fcd9c 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-16.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-16.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-17.c index e6d5ba8be..67405ec35 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-17.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-17.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-18.c index 2d3f7437f..4cd275946 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-18.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-18.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-19.c index b124d08b8..cc13b4a04 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-19.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-19.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-2.c index 0c7e8c698..10a06b34b 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-2.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-20.c index f01a4c2ec..cf5c9a067 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-20.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-20.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-21.c index 74fffa988..18c1be5ce 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-21.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-21.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-22.c index dbe6c55a1..f9971b3f2 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-22.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-22.c @@ -39,10 +39,12 @@ #include #include #include "posixtest.h" +static volatile sig_atomic_t called = 0; -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" -static volatile sig_atomic_t called = 0; +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) static void handler(int sig, siginfo_t *info, void *context) { @@ -57,6 +59,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-23.c index e0f54d835..ec07b89dc 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-23.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-23.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-24.c index bba928a57..fc2c87744 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-24.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-24.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-25.c index 62ebe7390..828f1fd14 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-25.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-25.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-26.c index c02c77397..0a666e59a 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-26.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-26.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-3.c index 5fb8c5fad..bd4a8831d 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-3.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-3.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-4.c index 993889041..6ab0f35ee 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-4.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-4.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-5.c index 9096ca426..a1f8ea115 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-5.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-5.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-6.c index 3b6799a4e..ed7aeafdd 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-6.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-6.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-7.c index 5d6b84bd3..f6ff253cd 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-7.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-7.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-8.c index ec2649165..fe745aab9 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-8.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-8.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-9.c index 91044863a..7e55e2722 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-9.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/19-9.c @@ -40,10 +40,13 @@ #include #include "posixtest.h" -#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) - static volatile sig_atomic_t called = 0; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + +#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1) + static void handler(int sig, siginfo_t *info, void *context) { (void) sig; @@ -57,6 +60,8 @@ static void handler(int sig, siginfo_t *info, void *context) called = 1; } +#pragma GCC diagnostic pop + int main(void) { int ret; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/9-1.c index 0236a752e..e9f9a8f71 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/9-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/9-1.c @@ -59,7 +59,10 @@ int main(int argc, char *argv[]) /* Get abs path if needed and exec ourself */ if (*argv[0] != '/') { - getcwd(path, PATH_MAX); + if (getcwd(path, PATH_MAX) == NULL) { + perror("getcwd"); + exit(PTS_UNRESOLVED); + } strcat(path, "/"); strcat(path, argv[0]); } else { diff --git a/testcases/open_posix_testsuite/include/affinity.h b/testcases/open_posix_testsuite/include/affinity.h index 86fb4f4c6..da7e6837e 100644 --- a/testcases/open_posix_testsuite/include/affinity.h +++ b/testcases/open_posix_testsuite/include/affinity.h @@ -46,7 +46,8 @@ static int get_online_cpu_from_sysfs(void) f = fopen("/sys/devices/system/cpu/online", "r"); if (!f) return -1; - fscanf(f, "%d", &cpu); + if (!fscanf(f, "%d", &cpu)) + cpu = -1; fclose(f); return cpu;