diff options
author | Jim Meyering <jim@meyering.net> | 2005-11-10 23:20:05 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2005-11-10 23:20:05 +0000 |
commit | e5475103aab873c96f2afb7bdfe86e413a3445d2 (patch) | |
tree | ae1cf50881bd7f3f14c30f477f7cbce6ae15912c | |
parent | 3afe2cd61ca031ad8fc9c14b823839df369a8342 (diff) | |
download | coreutils-e5475103aab873c96f2afb7bdfe86e413a3445d2.tar.xz |
(fstatat, unlinkat): Perform the syscall directly,
skipping the save_cwd...restore_cwd overhead, if FILE is absolute.
-rw-r--r-- | lib/openat.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/openat.c b/lib/openat.c index 092e39610..40d3cc6a2 100644 --- a/lib/openat.c +++ b/lib/openat.c @@ -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) |