From: Ulrich Drepper Date: Sat, 22 Jun 2002 05:51:25 +0000 (+0000) Subject: [__ASSUME_GETDENTS64_SYSCALL] (__GETDENTS): Check for failed getdents64 syscall. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ad286105256a5cd34d720999fd526f31e8f9068;p=thirdparty%2Fglibc.git [__ASSUME_GETDENTS64_SYSCALL] (__GETDENTS): Check for failed getdents64 syscall. --- diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c index 5d79a3a4d02..6dc9d714b5b 100644 --- a/sysdeps/unix/sysv/linux/getdents.c +++ b/sysdeps/unix/sysv/linux/getdents.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995-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 @@ -129,6 +129,10 @@ __GETDENTS (int fd, char *buf, size_t nbytes) const size_t size_diff = (offsetof (struct kernel_dirent64, d_name) - offsetof (DIRENT_TYPE, d_name)); + /* Return the error if encountered. */ + if (retval == -1) + return -1; + /* If the structure returned by the kernel is identical to what we need, don't do any conversions. */ if (offsetof (DIRENT_TYPE, d_name)