about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c8
-rw-r--r--sysdeps/unix/sysv/linux/fchmodat.c8
-rw-r--r--sysdeps/unix/sysv/linux/fchownat.c8
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c8
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat.c8
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat64.c8
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchownat.c8
-rw-r--r--sysdeps/unix/sysv/linux/i386/fxstatat.c8
-rw-r--r--sysdeps/unix/sysv/linux/linkat.c8
-rw-r--r--sysdeps/unix/sysv/linux/mkdirat.c8
-rw-r--r--sysdeps/unix/sysv/linux/openat.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/fchownat.c8
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c8
-rw-r--r--sysdeps/unix/sysv/linux/renameat.c14
-rw-r--r--sysdeps/unix/sysv/linux/symlinkat.c8
-rw-r--r--sysdeps/unix/sysv/linux/unlinkat.c8
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c8
-rw-r--r--sysdeps/unix/sysv/linux/xmknodat.c8
18 files changed, 132 insertions, 18 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/
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
index 8b420153f1..051691230d 100644
--- a/sysdeps/unix/sysv/linux/fchmodat.c
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -1,5 +1,5 @@
 /* Change the protections of 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
@@ -71,6 +71,12 @@ fchmodat (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/
diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c
index 0f731775b3..db43755694 100644
--- a/sysdeps/unix/sysv/linux/fchownat.c
+++ b/sysdeps/unix/sysv/linux/fchownat.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
@@ -66,6 +66,12 @@ fchownat (fd, file, owner, group, 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/
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
index 7c96b78045..bb83e74faf 100644
--- a/sysdeps/unix/sysv/linux/futimesat.c
+++ b/sysdeps/unix/sysv/linux/futimesat.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
@@ -76,6 +76,12 @@ futimesat (fd, file, tvp)
   else 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/
diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c
index 1b9add40d7..dd5c9bc684 100644
--- a/sysdeps/unix/sysv/linux/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/fxstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2007, 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
@@ -85,6 +85,12 @@ __fxstatat (int vers, int fd, const char *file, struct stat *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/
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/
diff --git a/sysdeps/unix/sysv/linux/i386/fchownat.c b/sysdeps/unix/sysv/linux/i386/fchownat.c
index 34acf10c27..1b02fde459 100644
--- a/sysdeps/unix/sysv/linux/i386/fchownat.c
+++ b/sysdeps/unix/sysv/linux/i386/fchownat.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
@@ -63,6 +63,12 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, 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/
diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c
index 94f6e81186..37757937b3 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstatat.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
@@ -86,6 +86,12 @@ __fxstatat (int vers, int fd, const char *file, struct stat *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/
diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c
index cfd0e18223..b2b7b0386b 100644
--- a/sysdeps/unix/sysv/linux/linkat.c
+++ b/sysdeps/unix/sysv/linux/linkat.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
@@ -66,6 +66,12 @@ linkat (fromfd, from, tofd, to, flags)
   if (fromfd != AT_FDCWD && from[0] != '/')
     {
       size_t filelen = strlen (from);
+      if (__builtin_expect (filelen == 0, 0))
+	{
+	  __set_errno (ENOENT);
+	  return -1;
+	}
+
       /* Buffer for the path name we are going to use.  It consists of
 	 - the string /proc/self/fd/
 	 - the file descriptor number
diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c
index 3c190085ce..aa89d08730 100644
--- a/sysdeps/unix/sysv/linux/mkdirat.c
+++ b/sysdeps/unix/sysv/linux/mkdirat.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
@@ -57,6 +57,12 @@ mkdirat (fd, file, mode)
   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/
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
index 45b566f2d0..7916c71105 100644
--- a/sysdeps/unix/sysv/linux/openat.c
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2007, 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
@@ -110,6 +110,12 @@ OPENAT_NOT_CANCEL (fd, file, oflag, mode)
   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/
diff --git a/sysdeps/unix/sysv/linux/powerpc/fchownat.c b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
index 67c570648a..46f6d97c6b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/fchownat.c
+++ b/sysdeps/unix/sysv/linux/powerpc/fchownat.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
@@ -66,6 +66,12 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, 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/
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
index 1361596503..1e9a9b649f 100644
--- a/sysdeps/unix/sysv/linux/readlinkat.c
+++ b/sysdeps/unix/sysv/linux/readlinkat.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
@@ -59,6 +59,12 @@ readlinkat (fd, path, buf, len)
   if (fd != AT_FDCWD && path[0] != '/')
     {
       size_t pathlen = strlen (path);
+      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/
diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
index 86bb75a7b0..160bdc4903 100644
--- a/sysdeps/unix/sysv/linux/renameat.c
+++ b/sysdeps/unix/sysv/linux/renameat.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
@@ -135,6 +135,12 @@ renameat (oldfd, old, newfd, new)
   if (oldfd != AT_FDCWD && old[0] != '/')
     {
       size_t filelen = strlen (old);
+      if (__builtin_expect (filelen == 0, 0))
+	{
+	  __set_errno (ENOENT);
+	  return -1;
+	}
+
       /* Buffer for the path name we are going to use.  It consists of
 	 - the string /proc/self/fd/
 	 - the file descriptor number
@@ -154,6 +160,12 @@ renameat (oldfd, old, newfd, new)
   if (newfd != AT_FDCWD && new[0] != '/')
     {
       size_t filelen = strlen (new);
+      if (__builtin_expect (filelen == 0, 0))
+	{
+	  __set_errno (ENOENT);
+	  return -1;
+	}
+
       /* Buffer for the path name we are going to use.  It consists of
 	 - the string /proc/self/fd/
 	 - the file descriptor number
diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c
index 4cfc924bfc..d2704777bd 100644
--- a/sysdeps/unix/sysv/linux/symlinkat.c
+++ b/sysdeps/unix/sysv/linux/symlinkat.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
@@ -57,6 +57,12 @@ symlinkat (from, tofd, to)
   if (tofd != AT_FDCWD && to[0] != '/')
     {
       size_t tolen = strlen (to);
+      if (__builtin_expect (tolen == 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/
diff --git a/sysdeps/unix/sysv/linux/unlinkat.c b/sysdeps/unix/sysv/linux/unlinkat.c
index 0a07a8a875..bb5f89810b 100644
--- a/sysdeps/unix/sysv/linux/unlinkat.c
+++ b/sysdeps/unix/sysv/linux/unlinkat.c
@@ -1,5 +1,5 @@
 /* unlinkat -- Remove a link by relative name.
-   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
@@ -64,6 +64,12 @@ unlinkat (fd, file, 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/
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
index 8b1c932ba9..cc41fdedc0 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.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
@@ -72,6 +72,12 @@ __fxstatat (int vers, int fd, const char *file, struct stat *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/
diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c
index ef27b686cc..177b3db986 100644
--- a/sysdeps/unix/sysv/linux/xmknodat.c
+++ b/sysdeps/unix/sysv/linux/xmknodat.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
@@ -72,6 +72,12 @@ __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
   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/