aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--elf/Makefile2
-rw-r--r--manual/string.texi6
-rw-r--r--nptl/ChangeLog4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h74
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h2
-rw-r--r--wcsmbs/wcpncpy.c23
7 files changed, 65 insertions, 53 deletions
diff --git a/ChangeLog b/ChangeLog
index 3ca7aa9dd2..0139b51bfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-06-01 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/Makefile (CFLAGS-dl-runtime.c): Define.
+
+ * wcsmbs/wcpncpy.c (__wcpncpy): Fix broken implementation to match
+ stpncpy.
+
2003-05-31 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h (SA_NOCLDWAIT): Define.
diff --git a/elf/Makefile b/elf/Makefile
index c557bd8f37..003f77e12e 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -82,6 +82,8 @@ distribute := rtld-Rules \
tst-array2dep.c \
check-textrel.c dl-sysdep.h
+CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
+
include ../Makeconfig
ifeq ($(unwind-find-fde),yes)
diff --git a/manual/string.texi b/manual/string.texi
index 872916b660..21941594b1 100644
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -708,9 +708,9 @@ This function is similar to @code{wcpcpy} but copies always exactly
If the length of @var{wfrom} is more then @var{size}, then
@code{wcpncpy} copies just the first @var{size} wide characters and
-returns a pointer to the wide character directly following the one which
-was copied last. Note that in this case there is no null terminator
-written into @var{wto}.
+returns a pointer to the wide character directly following the last
+non-null wide character which was copied last. Note that in this case
+there is no null terminator written into @var{wto}.
If the length of @var{wfrom} is less than @var{size}, then @code{wcpncpy}
copies all of @var{wfrom}, followed by enough null characters to add up
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index cc9c94d0c4..f3cd10738f 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -12,6 +12,10 @@
Likewise.
* sysdeps/unix/sysv/linux/s390/sem_timedwait.c (sem_timedwait):
Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_timedwait_tid):
+ Likewise.
+ * sysdeps/unix/sysv/linux/sh/lowlevellock.h (lll_timedwait_tid):
+ Likewise.
* Makefile (tests): Add tst-sem8 and tst-sem9.
* tst-sem8.c: New file.
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
index 8ac8416011..4a392e84d7 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
@@ -148,34 +148,34 @@ typedef int lll_lock_t;
# endif
#define lll_futex_wait(futex, val) \
- do { \
- int __ignore; \
- register unsigned long __r3 asm ("r3") = SYS_futex; \
- register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
- register unsigned long __r5 asm ("r5") = FUTEX_WAIT; \
- register unsigned long __r6 asm ("r6") = (unsigned long) (val); \
- register unsigned long __r7 asm ("r7") = 0; \
- __asm __volatile (SYSCALL_WITH_INST_PAD \
- : "=z" (__ignore) \
- : "r" (__r3), "r" (__r4), "r" (__r5), \
- "r" (__r6), "r" (__r7) \
- : "memory", "t"); \
+ do { \
+ int __ignore; \
+ register unsigned long __r3 asm ("r3") = SYS_futex; \
+ register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
+ register unsigned long __r5 asm ("r5") = FUTEX_WAIT; \
+ register unsigned long __r6 asm ("r6") = (unsigned long) (val); \
+ register unsigned long __r7 asm ("r7") = 0; \
+ __asm __volatile (SYSCALL_WITH_INST_PAD \
+ : "=z" (__ignore) \
+ : "r" (__r3), "r" (__r4), "r" (__r5), \
+ "r" (__r6), "r" (__r7) \
+ : "memory", "t"); \
} while (0)
#define lll_futex_wake(futex, nr) \
- do { \
- int __ignore; \
- register unsigned long __r3 asm ("r3") = SYS_futex; \
- register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
- register unsigned long __r5 asm ("r5") = FUTEX_WAKE; \
- register unsigned long __r6 asm ("r6") = (unsigned long) (nr); \
- register unsigned long __r7 asm ("r7") = 0; \
- __asm __volatile (SYSCALL_WITH_INST_PAD \
- : "=z" (__ignore) \
- : "r" (__r3), "r" (__r4), "r" (__r5), \
- "r" (__r6), "r" (__r7) \
- : "memory", "t"); \
+ do { \
+ int __ignore; \
+ register unsigned long __r3 asm ("r3") = SYS_futex; \
+ register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
+ register unsigned long __r5 asm ("r5") = FUTEX_WAKE; \
+ register unsigned long __r6 asm ("r6") = (unsigned long) (nr); \
+ register unsigned long __r7 asm ("r7") = 0; \
+ __asm __volatile (SYSCALL_WITH_INST_PAD \
+ : "=z" (__ignore) \
+ : "r" (__r3), "r" (__r4), "r" (__r5), \
+ "r" (__r6), "r" (__r7) \
+ : "memory", "t"); \
} while (0)
@@ -252,24 +252,24 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
extern int __lll_wait_tid (int *tid) attribute_hidden;
#define lll_wait_tid(tid) \
- do { \
- __typeof (tid) *__tid = &(tid); \
- if (*__tid != 0) \
- __lll_wait_tid (__tid); \
+ do { \
+ __typeof (tid) *__tid = &(tid); \
+ if (*__tid != 0) \
+ __lll_wait_tid (__tid); \
} while (0)
extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
attribute_hidden;
#define lll_timedwait_tid(tid, abstime) \
- ({ \
- int __result = 0; \
- if (tid != 0) \
- { \
- if (abstime == NULL || abstime->tv_nsec >= 1000000000) \
- __result = EINVAL; \
- else \
- __result = __lll_timedwait_tid (&tid, abstime); \
- } \
+ ({ \
+ int __result = 0; \
+ if (tid != 0) \
+ { \
+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) \
+ __result = EINVAL; \
+ else \
+ __result = __lll_timedwait_tid (&tid, abstime); \
+ } \
__result; })
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
index 136dc574e0..4dfbf4bb45 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
@@ -319,7 +319,7 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
int __result = 0; \
if (tid != 0) \
{ \
- if (abstime == NULL || abstime->tv_nsec >= 1000000000) \
+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) \
__result = EINVAL; \
else \
__result = __lll_timedwait_tid (&tid, abstime); \
diff --git a/wcsmbs/wcpncpy.c b/wcsmbs/wcpncpy.c
index 59b7301ca8..df7efd7fb0 100644
--- a/wcsmbs/wcpncpy.c
+++ b/wcsmbs/wcpncpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -58,9 +58,7 @@ __wcpncpy (dest, src, n)
if (--n4 == 0)
goto last_chars;
}
- n = n - (dest - s) - 1;
- if (n == 0)
- return dest;
+ n -= dest - s;
goto zero_fill;
}
@@ -69,21 +67,22 @@ __wcpncpy (dest, src, n)
if (n == 0)
return dest;
- do
+ for (;;)
{
c = *src++;
- *++dest = c;
- if (--n == 0)
+ --n;
+ *dest++ = c;
+ if (c == L'\0')
+ break;
+ if (n == 0)
return dest;
}
- while (c != L'\0');
zero_fill:
- do
- *++dest = L'\0';
- while (--n > 0);
+ while (n-- > 0)
+ dest[n] = L'\0';
- return dest;
+ return dest - 1;
}
weak_alias (__wcpncpy, wcpncpy)