Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-musl-libc: Commit

external/musl/libc


Commit MetaInfo

Revisione0eee3ceefd550724058ffbdf878e9eb06e18f18 (tree)
Time2019-07-11 06:06:00
AuthorSamuel Holland <samuel@shol...>
CommiterRich Felker

Log Message

fix restrict violations in internal use of several functions

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.

Change Summary

Incremental Difference

--- 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
113113
114114 if (st) {
115115 pthread_attr_t a;
116- sigset_t set;
116+ sigset_t set, set_old;
117117 pthread_t td;
118118
119119 if (sev->sigev_notify == SIGEV_THREAD) {
@@ -128,13 +128,13 @@ int lio_listio(int mode, struct aiocb *restrict const *restrict cbs, int cnt, st
128128 }
129129 pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
130130 sigfillset(&set);
131- pthread_sigmask(SIG_BLOCK, &set, &set);
131+ pthread_sigmask(SIG_BLOCK, &set, &set_old);
132132 if (pthread_create(&td, &a, wait_thread, st)) {
133133 free(st);
134134 errno = EAGAIN;
135135 return -1;
136136 }
137- pthread_sigmask(SIG_SETMASK, &set, 0);
137+ pthread_sigmask(SIG_SETMASK, &set_old, 0);
138138 }
139139
140140 return 0;
--- a/src/signal/sigset.c
+++ b/src/signal/sigset.c
@@ -3,7 +3,7 @@
33 void (*sigset(int sig, void (*handler)(int)))(int)
44 {
55 struct sigaction sa, sa_old;
6- sigset_t mask;
6+ sigset_t mask, mask_old;
77
88 sigemptyset(&mask);
99 if (sigaddset(&mask, sig) < 0)
@@ -12,7 +12,7 @@ void (*sigset(int sig, void (*handler)(int)))(int)
1212 if (handler == SIG_HOLD) {
1313 if (sigaction(sig, 0, &sa_old) < 0)
1414 return SIG_ERR;
15- if (sigprocmask(SIG_BLOCK, &mask, &mask) < 0)
15+ if (sigprocmask(SIG_BLOCK, &mask, &mask_old) < 0)
1616 return SIG_ERR;
1717 } else {
1818 sa.sa_handler = handler;
@@ -20,8 +20,8 @@ void (*sigset(int sig, void (*handler)(int)))(int)
2020 sigemptyset(&sa.sa_mask);
2121 if (sigaction(sig, &sa, &sa_old) < 0)
2222 return SIG_ERR;
23- if (sigprocmask(SIG_UNBLOCK, &mask, &mask) < 0)
23+ if (sigprocmask(SIG_UNBLOCK, &mask, &mask_old) < 0)
2424 return SIG_ERR;
2525 }
26- return sigismember(&mask, sig) ? SIG_HOLD : sa_old.sa_handler;
26+ return sigismember(&mask_old, sig) ? SIG_HOLD : sa_old.sa_handler;
2727 }
--- a/src/unistd/ualarm.c
+++ b/src/unistd/ualarm.c
@@ -7,7 +7,7 @@ unsigned ualarm(unsigned value, unsigned interval)
77 struct itimerval it = {
88 .it_interval.tv_usec = interval,
99 .it_value.tv_usec = value
10- };
11- setitimer(ITIMER_REAL, &it, &it);
12- return it.it_value.tv_sec*1000000 + it.it_value.tv_usec;
10+ }, it_old;
11+ setitimer(ITIMER_REAL, &it, &it_old);
12+ return it_old.it_value.tv_sec*1000000 + it_old.it_value.tv_usec;
1313 }
Show on old repository browser