mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
(fstatat, unlinkat): Perform the syscall directly,
skipping the save_cwd...restore_cwd overhead, if FILE is absolute.
This commit is contained in:
1 parent
3afe2cd61c
commit
e5475103aa
1 file changed
+2
-2
+2
-2
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user