]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(fstatat, unlinkat): Perform the syscall directly,
authorJim Meyering <jim@meyering.net>
Thu, 10 Nov 2005 23:20:05 +0000 (23:20 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 10 Nov 2005 23:20:05 +0000 (23:20 +0000)
skipping the save_cwd...restore_cwd overhead, if FILE is absolute.

lib/openat.c

index 092e39610d02db5e8c1e0f9b6de32b4cf153b266..40d3cc6a241987b6c0d5d444c4ee9a7d4e3e7fe5 100644 (file)
@@ -148,7 +148,7 @@ fstatat (int fd, char const *file, struct stat *st, int flag)
   int saved_errno;
   int err;
 
-  if (fd == AT_FDCWD)
+  if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
     return (flag == AT_SYMLINK_NOFOLLOW
            ? lstat (file, st)
            : stat (file, st));
@@ -192,7 +192,7 @@ unlinkat (int fd, char const *file, int flag)
   int saved_errno;
   int err;
 
-  if (fd == AT_FDCWD)
+  if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
     return (flag == AT_REMOVEDIR ? rmdir (file) : unlink (file));
 
   if (save_cwd (&saved_cwd) != 0)