aboutsummaryrefslogtreecommitdiff
path: root/dirent/scandir.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-10-14 18:10:15 +0000
committerUlrich Drepper <drepper@redhat.com>2002-10-14 18:10:15 +0000
commit89b91a92658e1980d28c3c78582062223e134514 (patch)
treeeba69c3ef34b57cc5995cdc2cf967291dff9e548 /dirent/scandir.c
parent5e3ab761da1f32e0b1ec303a431be7d1be8a0250 (diff)
downloadglibc-89b91a92658e1980d28c3c78582062223e134514.zip
glibc-89b91a92658e1980d28c3c78582062223e134514.tar.gz
glibc-89b91a92658e1980d28c3c78582062223e134514.tar.bz2
Update.
2002-10-12 H.J. Lu <hjl@gnu.org> * sunrpc/thrsvc.c (PROCQUIT): New. (struct rpc_arg): New. (dispatch): Call exit (0) if request->rq_proc == PROCQUIT. (test_one_call): Take struct rpc_arg * instead of CLIENT *c. (thread_wrapper): Modified for struct rpc_arg * and call PROCQUIT. (main): Modified for struct rpc_arg *. 2002-10-14 Ulrich Drepper <drepper@redhat.com> * dirent/scandir.c: Rearrange code a bit to reduce binary size. 2002-10-14 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Include tls.h. (SYSCALL_ERROR_HANDLER): Use RTLD_PRIVATE_ERRNO sequence in ld.so even if __thread is supported. 2002-10-13 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter): Add hack to prevent the compiler from clobbering the signal context. * sysdeps/unix/sysv/linux/sh/profil-counter.h (profil_counter): Likewise. * sysdeps/unix/sysv/linux/x86_64/profil-counter.h (profil_counter): Likewise.
Diffstat (limited to 'dirent/scandir.c')
-rw-r--r--dirent/scandir.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/dirent/scandir.c b/dirent/scandir.c
index d0604ab..9f3cc84 100644
--- a/dirent/scandir.c
+++ b/dirent/scandir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1998, 2000, 2002 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
@@ -80,20 +80,24 @@ SCANDIR (dir, namelist, select, cmp)
if (__builtin_expect (errno, 0) != 0)
{
save = errno;
- (void) __closedir (dp);
+
while (i > 0)
free (v[--i]);
free (v);
- __set_errno (save);
- return -1;
+
+ i = -1;
+ }
+ else
+ {
+ /* Sort the list if we have a comparison function to sort with. */
+ if (cmp != NULL)
+ qsort (v, i, sizeof (*v), cmp);
+
+ *namelist = v;
}
(void) __closedir (dp);
__set_errno (save);
- /* Sort the list if we have a comparison function to sort with. */
- if (cmp != NULL)
- qsort (v, i, sizeof (*v), cmp);
- *namelist = v;
return i;
}