summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorAndreas Schwab <aschwab@redhat.com>2009-06-16 13:04:18 +0200
committerAndreas Schwab <aschwab@redhat.com>2009-06-16 13:04:18 +0200
commit8a598439b93552cb666ab3cf63a5ff8aabd06260 (patch)
tree50934cb3f9879206cc36e9c80516ef7eb956719c /sysdeps
parentc38262349f9ad25d708e47a6715e94d87aa924ce (diff)
parent837dea7cf54827d6e43d88a9463bcc10d30472d0 (diff)
Merge branch 'master' of sourceware.org:/git/glibc into fedora/master
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/dl-irel.h2
-rw-r--r--sysdeps/posix/libc_fatal.c17
-rw-r--r--sysdeps/unix/sysv/linux/grantpt.c13
-rw-r--r--sysdeps/unix/sysv/linux/libc_fatal.c18
-rw-r--r--sysdeps/x86_64/bits/select.h36
5 files changed, 50 insertions, 36 deletions
diff --git a/sysdeps/i386/dl-irel.h b/sysdeps/i386/dl-irel.h
index 810a35050b..30385a1ef8 100644
--- a/sysdeps/i386/dl-irel.h
+++ b/sysdeps/i386/dl-irel.h
@@ -35,7 +35,7 @@ elf_irel (const Elf32_Rel *reloc)
if (__builtin_expect (r_type == R_386_IRELATIVE, 1))
{
- Elf64_Addr value = ((Elf32_Addr (*) (void)) (*reloc_addr)) ();
+ Elf32_Addr value = ((Elf32_Addr (*) (void)) (*reloc_addr)) ();
*reloc_addr = value;
}
else
diff --git a/sysdeps/posix/libc_fatal.c b/sysdeps/posix/libc_fatal.c
index c611b84363..4f11c0fcb0 100644
--- a/sysdeps/posix/libc_fatal.c
+++ b/sysdeps/posix/libc_fatal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1994,1995,1997,2000,2004,2005
+/* Copyright (C) 1993-1995,1997,2000,2004,2005,2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <atomic.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
@@ -123,6 +124,20 @@ __libc_message (int do_abort, const char *fmt, ...)
if (TEMP_FAILURE_RETRY (__writev (fd, iov, nlist)) == total)
written = true;
+
+ char *buf = do_abort ? malloc (total + 1) : NULL;
+ if (buf != NULL)
+ {
+ char *wp = buf;
+ for (int cnt = 0; cnt < nlist; ++cnt)
+ wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
+ *wp = '\0';
+
+ /* We have to free the old buffer since the application might
+ catch the SIGABRT signal. */
+ char *old = atomic_exchange_acq (&__abort_msg, buf);
+ free (old);
+ }
}
va_end (ap);
diff --git a/sysdeps/unix/sysv/linux/grantpt.c b/sysdeps/unix/sysv/linux/grantpt.c
index b894b8b631..c858f89c8b 100644
--- a/sysdeps/unix/sysv/linux/grantpt.c
+++ b/sysdeps/unix/sysv/linux/grantpt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001, 2002, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -70,9 +70,16 @@ grantpt (int fd)
return -1;
/* If the slave pseudo terminal lives on a `devpts' filesystem, the
- ownership and access permission are already set. */
+ ownership is already set and the access permission might already
+ be set. */
if (fsbuf.f_type == DEVPTS_SUPER_MAGIC || fsbuf.f_type == DEVFS_SUPER_MAGIC)
- return 0;
+ {
+ struct stat64 st;
+
+ if (fstat (fd, &st) == 0
+ && (st.st_mode & ACCESSPERMS) == (S_IRUSR|S_IWUSR|S_IWGRP))
+ return 0;
+ }
return __unix_grantpt (fd);
}
diff --git a/sysdeps/unix/sysv/linux/libc_fatal.c b/sysdeps/unix/sysv/linux/libc_fatal.c
index c7fac6ab51..7287f4ef6c 100644
--- a/sysdeps/unix/sysv/linux/libc_fatal.c
+++ b/sysdeps/unix/sysv/linux/libc_fatal.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993-1995,1997,2000,2002-2005 Free Software Foundation, Inc.
+/* Copyright (C) 1993-1995,1997,2000,2002-2005,2009
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <atomic.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
@@ -131,6 +133,20 @@ __libc_message (int do_abort, const char *fmt, ...)
if (cnt == total)
written = true;
+
+ char *buf = do_abort ? malloc (total + 1) : NULL;
+ if (buf != NULL)
+ {
+ char *wp = buf;
+ for (int cnt = 0; cnt < nlist; ++cnt)
+ wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
+ *wp = '\0';
+
+ /* We have to free the old buffer since the application might
+ catch the SIGABRT signal. */
+ char *old = atomic_exchange_acq (&__abort_msg, buf);
+ free (old);
+ }
}
va_end (ap);
diff --git a/sysdeps/x86_64/bits/select.h b/sysdeps/x86_64/bits/select.h
index 7f23cb59b1..5f31b84080 100644
--- a/sysdeps/x86_64/bits/select.h
+++ b/sysdeps/x86_64/bits/select.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2001, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2001,2008,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,14 +27,8 @@
# if __WORDSIZE == 64
# define __FD_ZERO_STOS "stosq"
-# define __FD_SET_BTS "btsq"
-# define __FD_CLR_BTR "btrq"
-# define __FD_ISSET_BT "btq"
# else
# define __FD_ZERO_STOS "stosl"
-# define __FD_SET_BTS "btsl"
-# define __FD_CLR_BTR "btrl"
-# define __FD_ISSET_BT "btl"
# endif
# define __FD_ZERO(fdsp) \
@@ -48,26 +42,6 @@
: "memory"); \
} while (0)
-# define __FD_SET(fd, fdsp) \
- __asm__ __volatile__ (__FD_SET_BTS " %1,%0" \
- : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
- : "r" (((int) (fd)) % __NFDBITS) \
- : "cc","memory")
-# define __FD_CLR(fd, fdsp) \
- __asm__ __volatile__ (__FD_CLR_BTR " %1,%0" \
- : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
- : "r" (((int) (fd)) % __NFDBITS) \
- : "cc","memory")
-# define __FD_ISSET(fd, fdsp) \
- (__extension__ \
- ({register char __result; \
- __asm__ __volatile__ (__FD_ISSET_BT " %1,%2 ; setcb %b0" \
- : "=q" (__result) \
- : "r" (((int) (fd)) % __NFDBITS), \
- "m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
- : "cc"); \
- __result; }))
-
#else /* ! GNU CC */
/* We don't use `memset' because this would require a prototype and
@@ -79,8 +53,10 @@
for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \
__FDS_BITS (__arr)[__i] = 0; \
} while (0)
-# define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))
-# define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))
-# define __FD_ISSET(d, set) (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d))
#endif /* GNU CC */
+
+#define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))
+#define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))
+#define __FD_ISSET(d, set) \
+ ((__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d)) != 0)