about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>1999-04-07 05:12:03 +0000
committerAndreas Schwab <schwab@suse.de>1999-04-07 05:12:03 +0000
commit516d718a39eb540abca2915499b925962886ded9 (patch)
treed3c1b9dd02ae0a7b6974490546ef755e20088f96
parent5a56576d453c1b386fb6a54ed7c14f17c8169990 (diff)
downloadglibc-516d718a39eb540abca2915499b925962886ded9.tar.gz
glibc-516d718a39eb540abca2915499b925962886ded9.tar.xz
glibc-516d718a39eb540abca2915499b925962886ded9.zip
1999-04-07 Andreas Jaeger <aj@arthur.rhein-neckar.de>
	* sysdeps/unix/sysv/linux/getdents.c (__getdirentries): Return
	directly if getdents returns with error set.
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/unix/sysv/linux/getdents.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 93fea9a60d..c963092e73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1999-04-07  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* sysdeps/unix/sysv/linux/getdents.c (__getdirentries): Return
+	directly if getdents returns with error set.
+
 1999-04-05  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
 
 	* locale/langinfo.h (THOUSEP): Rename second occurence of
diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c
index b59acc0e1c..e0180dfa2e 100644
--- a/sysdeps/unix/sysv/linux/getdents.c
+++ b/sysdeps/unix/sysv/linux/getdents.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999 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
@@ -82,6 +82,9 @@ __getdirentries (int fd, char *buf, size_t nbytes, off_t *basep)
 
   retval = INLINE_SYSCALL (getdents, 3, fd, (char *) kdp, red_nbytes);
 
+  if (retval == -1)
+    return -1;
+  
   while ((char *) kdp < (char *) skdp + retval)
     {
       const size_t alignment = __alignof__ (struct dirent);