about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/faccessat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/faccessat.c')
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
index 10b903d076..c154deb40f 100644
--- a/sysdeps/unix/sysv/linux/faccessat.c
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -1,5 +1,5 @@
 /* Test for access to file, relative to open directory.  Linux version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 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
@@ -72,6 +72,12 @@ faccessat (fd, file, mode, flag)
       if (fd != AT_FDCWD && file[0] != '/')
 	{
 	  size_t filelen = strlen (file);
+	  if (__builtin_expect (filelen == 0, 0))
+	    {
+	      __set_errno (ENOENT);
+	      return -1;
+	    }
+
 	  static const char procfd[] = "/proc/self/fd/%d/%s";
 	  /* Buffer for the path name we are going to use.  It consists of
 	     - the string /proc/self/fd/