Merge branch 'dfsg-orig' into dfsg-debian
[debian/tar] / gnu / fchownat.c
index 87c54937a5dd9f96f9657f4033780bc5690355ce..3bf5daa1ade1933814107ebb3f7902d59d15ebac 100644 (file)
@@ -1,12 +1,10 @@
-/* -*- buffer-read-only: t -*- vi: set ro: */
-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
 /* This function serves as replacement for a missing fchownat function,
    as well as a work around for the fchownat bug in glibc-2.4:
     <http://lists.ubuntu.com/archives/ubuntu-users/2006-September/093218.html>
    when the buggy fchownat-with-AT_SYMLINK_NOFOLLOW operates on a symlink, it
    mistakenly affects the symlink referent, rather than the symlink itself.
 
-   Copyright (C) 2006-2007, 2009-2010 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 static int
 local_lchownat (int fd, char const *file, uid_t owner, gid_t group);
 
-# define AT_FUNC_NAME local_lchownat
-# define AT_FUNC_F1 lchown
-# define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group
-# define AT_FUNC_POST_FILE_ARGS        , owner, group
-# include "at-func.c"
-# undef AT_FUNC_NAME
-# undef AT_FUNC_F1
-# undef AT_FUNC_POST_FILE_PARAM_DECLS
-# undef AT_FUNC_POST_FILE_ARGS
+#  define AT_FUNC_NAME local_lchownat
+#  define AT_FUNC_F1 lchown
+#  define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group
+#  define AT_FUNC_POST_FILE_ARGS        , owner, group
+#  include "at-func.c"
+#  undef AT_FUNC_NAME
+#  undef AT_FUNC_F1
+#  undef AT_FUNC_POST_FILE_PARAM_DECLS
+#  undef AT_FUNC_POST_FILE_ARGS
 
 # endif
 
@@ -90,6 +88,13 @@ rpl_fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag)
   if (flag == AT_SYMLINK_NOFOLLOW)
     return local_lchownat (fd, file, owner, group);
 # endif
+# if FCHOWNAT_EMPTY_FILENAME_BUG
+  if (file[0] == '\0')
+    {
+      errno = ENOENT;
+      return -1;
+    }
+# endif
 # if CHOWN_TRAILING_SLASH_BUG
   {
     size_t len = strlen (file);