]> sourceware.org Git - glibc.git/commit
Add freopen special-case tests: chroot, EFBIG, stdin/stdout/stderr
authorJoseph Myers <josmyers@redhat.com>
Fri, 20 Sep 2024 23:26:31 +0000 (23:26 +0000)
committerJoseph Myers <josmyers@redhat.com>
Fri, 20 Sep 2024 23:26:31 +0000 (23:26 +0000)
commite0f3bf10acf4aab27752847828bfecd3fce41190
treecce7a60beb2c78cdd2b19e76f282eb1013017a93
parent94ca2c0894f0e1b62625c369cc598a2b9236622c
Add freopen special-case tests: chroot, EFBIG, stdin/stdout/stderr

Add tests of special cases for freopen that were omitted from the more
general tests of different modes and similar issues.  The special
cases in the three tests here are logically unconnected, it was simply
convenient to put these tests in one patch.

* Test freopen with a NULL path to the new file, in a chroot.  Rather
  than asserting that this fails (logically, failure in this case is
  an implementation detail; it's not required for freopen to rely on
  /proc), verify that either it fails (without memory leaks) or that
  it succeeds and behaves as expected on success.  There is no check
  for file descriptor leaks because the machinery for that also
  depends on /proc, so can't be used in a chroot.

* Test that freopen and freopen64 are genuinely different in
  configurations with 32-bit off_t by checking for an EFBIG trying to
  write past 2GB in a file opened with freopen in such a configuration
  but no error with 64-bit off_t or when opening with freopen64.

* Test freopen of stdin, stdout and stderr.

Tested for x86_64 and x86.
stdio-common/Makefile
stdio-common/tst-freopen4-main.c [new file with mode: 0644]
stdio-common/tst-freopen4.c [new file with mode: 0644]
stdio-common/tst-freopen5.c [new file with mode: 0644]
stdio-common/tst-freopen6-main.c [new file with mode: 0644]
stdio-common/tst-freopen6.c [new file with mode: 0644]
stdio-common/tst-freopen64-4.c [new file with mode: 0644]
stdio-common/tst-freopen64-6.c [new file with mode: 0644]
This page took 0.041853 seconds and 5 git commands to generate.