]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/glibc/glibc-rh1124204.patch
dhcpcd: fix delay after dhcp down.
[ipfire-2.x.git] / src / patches / glibc / glibc-rh1124204.patch
CommitLineData
bb330e25
AF
1#
2# Derived from this upstream commit:
3#
4# commit 58a1335e76a553e1cf4edeebc27f16fc9b53d6e6
5# Author: Petr Baudis <pasky@ucw.cz>
6# Date: Thu Mar 14 01:16:53 2013 +0100
7#
8# Fix __times() handling of EFAULT when buf is NULL
9#
10# 2013-03-14 Petr Baudis <pasky@ucw.cz>
11#
12# * sysdeps/unix/sysv/linux/times.c (__times): On EFAULT, test
13# for non-NULL pointer before the memory validity test. Pointed
14# out by Holger Brunck <holger.brunck@keymile.com>.
15#
16diff --git a/sysdeps/unix/sysv/linux/times.c b/sysdeps/unix/sysv/linux/times.c
17index f3b5f01..e59bb4e 100644
18--- a/sysdeps/unix/sysv/linux/times.c
19+++ b/sysdeps/unix/sysv/linux/times.c
20@@ -26,13 +26,14 @@ __times (struct tms *buf)
21 INTERNAL_SYSCALL_DECL (err);
22 clock_t ret = INTERNAL_SYSCALL (times, err, 1, buf);
23 if (INTERNAL_SYSCALL_ERROR_P (ret, err)
24- && __builtin_expect (INTERNAL_SYSCALL_ERRNO (ret, err) == EFAULT, 0))
25+ && __builtin_expect (INTERNAL_SYSCALL_ERRNO (ret, err) == EFAULT, 0)
26+ && buf)
27 {
28 /* This might be an error or not. For architectures which have
29 no separate return value and error indicators we cannot
30 distinguish a return value of -1 from an error. Do it the
31- hard way. We crash applications which pass in an invalid BUF
32- pointer. */
33+ hard way. We crash applications which pass in an invalid
34+ non-NULL BUF pointer. Linux allows BUF to be NULL. */
35 #define touch(v) \
36 do { \
37 clock_t temp = v; \
38@@ -44,7 +45,8 @@ __times (struct tms *buf)
39 touch (buf->tms_cutime);
40 touch (buf->tms_cstime);
41
42- /* If we come here the memory is valid and the kernel did not
43+ /* If we come here the memory is valid (or BUF is NULL, which is
44+ * a valid condition for the kernel syscall) and the kernel did not
45 return an EFAULT error. Return the value given by the kernel. */
46 }
47