aboutsummaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
Diffstat (limited to 'io')
-rw-r--r--io/Makefile2
-rw-r--r--io/Versions3
-rw-r--r--io/isatty.c31
-rw-r--r--io/isatty_nostatus.c29
-rw-r--r--io/tst-stat-time64.c6
-rw-r--r--io/tst-stat.c20
6 files changed, 25 insertions, 66 deletions
diff --git a/io/Makefile b/io/Makefile
index edee38e..435f5a9 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -91,8 +91,6 @@ routines := \
getcwd \
getdirname \
getwd \
- isatty \
- isatty_nostatus \
lchmod \
lchown \
link \
diff --git a/io/Versions b/io/Versions
index 4e19540..04d196e 100644
--- a/io/Versions
+++ b/io/Versions
@@ -26,9 +26,6 @@ libc {
# g*
get_current_dir_name; getcwd; getwd;
- # i*
- isatty;
-
# l*
lchown; link; lockf; lseek;
diff --git a/io/isatty.c b/io/isatty.c
deleted file mode 100644
index 3f3912d..0000000
--- a/io/isatty.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1991-2025 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Return 1 if FD is a terminal, 0 if not. */
-int
-__isatty (int fd)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
-weak_alias (__isatty, isatty)
-
-stub_warning (isatty)
diff --git a/io/isatty_nostatus.c b/io/isatty_nostatus.c
deleted file mode 100644
index e8ee796..0000000
--- a/io/isatty_nostatus.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1991-2025 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Return 1 if FD is a terminal, 0 if not, without changing errno */
-int
-__isatty_nostatus (int fd)
-{
- int save_errno = errno;
- int res = __isatty (fd);
- __set_errno (save_errno);
- return res;
-}
diff --git a/io/tst-stat-time64.c b/io/tst-stat-time64.c
index a20265c..4415765 100644
--- a/io/tst-stat-time64.c
+++ b/io/tst-stat-time64.c
@@ -52,6 +52,12 @@ fstat_check (int fd, const char *path, struct stat *st)
static void
fstatat_check (int fd, const char *path, struct stat *st)
{
+ TEST_COMPARE (fstatat (fd, "", st, 0), -1);
+ TEST_COMPARE (errno, ENOENT);
+
+ TEST_COMPARE (fstatat (AT_FDCWD, "_non_existing_file", st, 0), -1);
+ TEST_COMPARE (errno, ENOENT);
+
TEST_COMPARE (fstatat (fd, path, st, 0), 0);
}
diff --git a/io/tst-stat.c b/io/tst-stat.c
index cc57aec..aeea435 100644
--- a/io/tst-stat.c
+++ b/io/tst-stat.c
@@ -56,15 +56,29 @@ fstatat_check (int fd, const char *path, struct stat *st)
TEST_COMPARE (fstatat (fd, "", st, 0), -1);
TEST_COMPARE (errno, ENOENT);
+ TEST_COMPARE (fstatat (AT_FDCWD, "_non_existing_file", st, 0), -1);
+ TEST_COMPARE (errno, ENOENT);
+
TEST_COMPARE (fstatat (fd, path, st, 0), 0);
}
+static void
+fstatat_link (const char *path, struct stat *st)
+{
+ TEST_COMPARE (fstatat (AT_FDCWD, path, st, 0), -1);
+ TEST_COMPARE (errno, ENOENT);
+
+ TEST_COMPARE (fstatat (AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW), 0);
+ TEST_COMPARE (!S_ISLNK(st->st_mode), 0);
+}
+
typedef void (*test_t)(int, const char *path, struct stat *);
static int
do_test (void)
{
char *path;
+ const char *linkame = "tst-fstat.linkname";
int fd = create_temp_file ("tst-fstat.", &path);
TEST_VERIFY_EXIT (fd >= 0);
support_write_file_string (path, "abc");
@@ -78,13 +92,13 @@ do_test (void)
printf ("warning: timestamp with nanoseconds not supported\n");
struct statx stx;
+ struct stat st;
TEST_COMPARE (statx (fd, path, 0, STATX_BASIC_STATS, &stx), 0);
test_t tests[] = { stat_check, lstat_check, fstat_check, fstatat_check };
for (int i = 0; i < array_length (tests); i++)
{
- struct stat st;
tests[i](fd, path, &st);
TEST_COMPARE (stx.stx_dev_major, major (st.st_dev));
@@ -108,6 +122,10 @@ do_test (void)
}
}
+ TEST_COMPARE (symlink ("tst-fstat.target", linkame), 0);
+ add_temp_file (linkame);
+ fstatat_link (linkame, &st);
+
return 0;
}