From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14304 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Samuel Holland Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH v2 1/3] resolve -Wrestrict warnings Date: Sat, 29 Jun 2019 18:19:04 -0500 Message-ID: <20190629231906.64452-2-samuel@sholland.org> References: <20190629231906.64452-1-samuel@sholland.org> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="250769"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Samuel Holland To: musl@lists.openwall.com Original-X-From: musl-return-14320-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jun 30 01:19:31 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hhMd0-00137t-Go for gllmg-musl@m.gmane.org; Sun, 30 Jun 2019 01:19:30 +0200 Original-Received: (qmail 18213 invoked by uid 550); 29 Jun 2019 23:19:21 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 18114 invoked from network); 29 Jun 2019 23:19:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=5SJ1RfZ3db+aI 1Vv8o83p+tm5tqrqqwKYR2VtMdQhho=; b=vAYTOchvnnIdnvssc+956DZOXPgsZ Uc7lnAG5XPgFqGROLdIKJgU+dteQ1JH0Hu1vw+fm+fF+mmXyX/lmuqVZJl59HY84 qOivxdo77m5mif2qdJFxtLpZhTf/Ds9rT7aB2yckMrLyjTiUcbmG8VMJy7vjEuwB NHCo14l8DXbUIDgiqbDU23XJp5H8bdRVzvEoqBQJ3db4gGti9pC6SsmAK+9aeYSL L+oUEHq8zFXXqii+TYljZv61iFXVj5kKUTH1YzjLezL1eWumf/y+ta/KkV0OM4UZ bHukLlagaApNoSQzqb9KDFFZmcae1v0n/+GzWxozJHUoigY5s8aeF/YbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=5SJ1RfZ3db+aI1Vv8o83p+tm5tqrqqwKYR2VtMdQhho=; b=pVyr/D8M YH9BR79dKn2pohJp9mLVgRIJB5PPQUkkJmf4rUDMHMOj7HupU5vW62w1712doiVB Q12qRoiou0NE6ZR9ibDIwRCAwhgyxD3dOg+AZZ0pMo412WLcCSk6Obvlsx9rB9At arOWqeDqFZxvvrJaiPzBPeSkruzKmQ3/J1r30dmgzUQukYHc/T4zYWQ08UOjuSwz eC+VR4m4VFY1oTq2AVbKPnjieSeUcIXCkpzkNla18AStjUxIeZXP2aq0/CQITyYP kJNIVNMq5n0m88IYz2CBXGfmUZVKWcYrIp5FrrJ019BNaeWT43nZJdq3afwOtUWg iNCXf5wDsQKGvQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrvdefgddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefurghmuhgvlhcujfholhhlrghnugcuoehsrghmuhgvlhesshhh ohhllhgrnhgurdhorhhgqeenucfkphepjedtrddufeehrddugeekrdduhedunecurfgrrh grmhepmhgrihhlfhhrohhmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgnecuvehl uhhsthgvrhfuihiivgeptd X-ME-Proxy: X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190629231906.64452-1-samuel@sholland.org> Xref: news.gmane.org gmane.linux.lib.musl.general:14304 Archived-At: The old/new parameters to pthread_sigmask, sigprocmask, and setitimer are marked __restrict, so passing the same address to both is prohibited. Modify callers of these functions to use a separate object for each argument. --- src/aio/lio_listio.c | 6 +++--- src/signal/sigset.c | 8 ++++---- src/unistd/ualarm.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/aio/lio_listio.c b/src/aio/lio_listio.c index 7b6a03d3..0799c15d 100644 --- a/src/aio/lio_listio.c +++ b/src/aio/lio_listio.c @@ -113,7 +113,7 @@ int lio_listio(int mode, struct aiocb *restrict const *restrict cbs, int cnt, st if (st) { pthread_attr_t a; - sigset_t set; + sigset_t set, set_old; pthread_t td; if (sev->sigev_notify == SIGEV_THREAD) { @@ -128,13 +128,13 @@ int lio_listio(int mode, struct aiocb *restrict const *restrict cbs, int cnt, st } pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED); sigfillset(&set); - pthread_sigmask(SIG_BLOCK, &set, &set); + pthread_sigmask(SIG_BLOCK, &set, &set_old); if (pthread_create(&td, &a, wait_thread, st)) { free(st); errno = EAGAIN; return -1; } - pthread_sigmask(SIG_SETMASK, &set, 0); + pthread_sigmask(SIG_SETMASK, &set_old, 0); } return 0; diff --git a/src/signal/sigset.c b/src/signal/sigset.c index 0d7b4564..f3e8c407 100644 --- a/src/signal/sigset.c +++ b/src/signal/sigset.c @@ -3,7 +3,7 @@ void (*sigset(int sig, void (*handler)(int)))(int) { struct sigaction sa, sa_old; - sigset_t mask; + sigset_t mask, mask_old; sigemptyset(&mask); if (sigaddset(&mask, sig) < 0) @@ -12,7 +12,7 @@ void (*sigset(int sig, void (*handler)(int)))(int) if (handler == SIG_HOLD) { if (sigaction(sig, 0, &sa_old) < 0) return SIG_ERR; - if (sigprocmask(SIG_BLOCK, &mask, &mask) < 0) + if (sigprocmask(SIG_BLOCK, &mask, &mask_old) < 0) return SIG_ERR; } else { sa.sa_handler = handler; @@ -20,8 +20,8 @@ void (*sigset(int sig, void (*handler)(int)))(int) sigemptyset(&sa.sa_mask); if (sigaction(sig, &sa, &sa_old) < 0) return SIG_ERR; - if (sigprocmask(SIG_UNBLOCK, &mask, &mask) < 0) + if (sigprocmask(SIG_UNBLOCK, &mask, &mask_old) < 0) return SIG_ERR; } - return sigismember(&mask, sig) ? SIG_HOLD : sa_old.sa_handler; + return sigismember(&mask_old, sig) ? SIG_HOLD : sa_old.sa_handler; } diff --git a/src/unistd/ualarm.c b/src/unistd/ualarm.c index 855504bc..2985855c 100644 --- a/src/unistd/ualarm.c +++ b/src/unistd/ualarm.c @@ -7,7 +7,7 @@ unsigned ualarm(unsigned value, unsigned interval) struct itimerval it = { .it_interval.tv_usec = interval, .it_value.tv_usec = value - }; - setitimer(ITIMER_REAL, &it, &it); - return it.it_value.tv_sec*1000000 + it.it_value.tv_usec; + }, it_old; + setitimer(ITIMER_REAL, &it, &it_old); + return it_old.it_value.tv_sec*1000000 + it_old.it_value.tv_usec; } -- 2.21.0