(fstatat, unlinkat): Perform the syscall directly,

skipping the save_cwd...restore_cwd overhead, if FILE is absolute.
This commit is contained in:
Jim Meyering committed 2005-11-10 23:20:05 +00:00
1 parent 3afe2cd61c
commit e5475103aa
1 file changed
+2 -2
+2 -2
View 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)