From patchwork Wed Apr 22 08:27:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 38836 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from albireo.enyo.de (albireo.enyo.de [37.24.231.21]) by sourceware.org (Postfix) with ESMTPS id 590E0386F43F for ; Wed, 22 Apr 2020 08:27:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 590E0386F43F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=deneb.enyo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=fw@deneb.enyo.de Received: from [172.17.203.2] (helo=deneb.enyo.de) by albireo.enyo.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1jRAj0-0007NQ-64 for libc-alpha@sourceware.org; Wed, 22 Apr 2020 08:27:18 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.92) (envelope-from ) id 1jRAj0-0007D6-21 for libc-alpha@sourceware.org; Wed, 22 Apr 2020 10:27:18 +0200 From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] signal: Use for sigemptyset, sigfillset Date: Wed, 22 Apr 2020 10:27:18 +0200 Message-ID: <87eesglyc9.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2020 08:27:20 -0000 This avoids changing the entire sigset_t structure. Updating the actually used part is sufficient. Tested on x86_64-linux-gnu and i686-linux-gnu. ----- signal/sigempty.c | 7 +++---- signal/sigfillset.c | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/signal/sigempty.c b/signal/sigempty.c index 794e449997..e9f3b571b6 100644 --- a/signal/sigempty.c +++ b/signal/sigempty.c @@ -17,20 +17,19 @@ #include #include -#include +#include /* Clear all signals from SET. */ int sigemptyset (sigset_t *set) { - if (set == NULL) + if (__glibc_unlikely (set == NULL)) { __set_errno (EINVAL); return -1; } - memset (set, 0, sizeof (sigset_t)); - + __sigemptyset (set); return 0; } libc_hidden_def (sigemptyset) diff --git a/signal/sigfillset.c b/signal/sigfillset.c index 0ca8b6b534..29e98a5864 100644 --- a/signal/sigfillset.c +++ b/signal/sigfillset.c @@ -17,8 +17,8 @@ #include #include -#include #include +#include /* Set all signals in SET. */ int @@ -30,10 +30,8 @@ sigfillset (sigset_t *set) return -1; } - memset (set, 0xff, sizeof (sigset_t)); - + __sigfillset (set); __clear_internal_signals (set); - return 0; } libc_hidden_def (sigfillset)