public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] nptl: Handle NULL abstime [BZ #26394]
@ 2020-08-17 12:28 H.J. Lu
0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2020-08-17 12:28 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cb7e7a5ca1d6d25d59bc038bdc09630e507c41e5
commit cb7e7a5ca1d6d25d59bc038bdc09630e507c41e5
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sat Aug 15 11:06:35 2020 -0700
nptl: Handle NULL abstime [BZ #26394]
Since abstime passed to pthread_{clock|timed}join_np may be NULL, convert
to 64 bit abstime only if abstime isn't NULL.
Diff:
---
nptl/pthread_clockjoin.c | 12 +++++++++---
nptl/pthread_timedjoin.c | 10 +++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/nptl/pthread_clockjoin.c b/nptl/pthread_clockjoin.c
index 3cd780f688..0baba1e83d 100644
--- a/nptl/pthread_clockjoin.c
+++ b/nptl/pthread_clockjoin.c
@@ -34,9 +34,15 @@ int
__pthread_clockjoin_np (pthread_t threadid, void **thread_return,
clockid_t clockid, const struct timespec *abstime)
{
- struct __timespec64 ts64 = valid_timespec_to_timespec64 (*abstime);
-
- return __pthread_clockjoin_np64 (threadid, thread_return, clockid, &ts64);
+ if (abstime != NULL)
+ {
+ struct __timespec64 ts64 = valid_timespec_to_timespec64 (*abstime);
+ return __pthread_clockjoin_np64 (threadid, thread_return, clockid,
+ &ts64);
+ }
+ else
+ return __pthread_clockjoin_np64 (threadid, thread_return, clockid,
+ NULL);
}
#endif
weak_alias (__pthread_clockjoin_np, pthread_clockjoin_np)
diff --git a/nptl/pthread_timedjoin.c b/nptl/pthread_timedjoin.c
index 6164ae7060..6ade58853c 100644
--- a/nptl/pthread_timedjoin.c
+++ b/nptl/pthread_timedjoin.c
@@ -34,9 +34,13 @@ int
__pthread_timedjoin_np (pthread_t threadid, void **thread_return,
const struct timespec *abstime)
{
- struct __timespec64 ts64 = valid_timespec_to_timespec64 (*abstime);
-
- return __pthread_timedjoin_np64 (threadid, thread_return, &ts64);
+ if (abstime != NULL)
+ {
+ struct __timespec64 ts64 = valid_timespec_to_timespec64 (*abstime);
+ return __pthread_timedjoin_np64 (threadid, thread_return, &ts64);
+ }
+ else
+ return __pthread_timedjoin_np64 (threadid, thread_return, NULL);
}
#endif
weak_alias (__pthread_timedjoin_np, pthread_timedjoin_np)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-17 12:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17 12:28 [glibc] nptl: Handle NULL abstime [BZ #26394] H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).