From 801720e63b20e3b8215764ff0d68a29534ca7e62 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Thu, 29 Oct 2009 21:33:26 -0700
Subject: Fix compat handling in *at functions.

When passed an empty string for the filename, the compat code
using /proc in all *at functions did the wrong thing.
---
 sysdeps/unix/sysv/linux/fxstatat64.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'sysdeps/unix/sysv/linux/fxstatat64.c')

diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c
index cb932b8e59..442e4ca989 100644
--- a/sysdeps/unix/sysv/linux/fxstatat64.c
+++ b/sysdeps/unix/sysv/linux/fxstatat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 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
@@ -90,6 +90,12 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int 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/
-- 
cgit v1.2.3-70-g09d2