Page MenuHomeFreeBSD

D47009.id144469.diff
No OneTemporary

D47009.id144469.diff

diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c
--- a/usr.bin/env/env.c
+++ b/usr.bin/env/env.c
@@ -207,6 +207,8 @@
}
for (ep = environ; *ep; ep++)
(void)printf("%s%c", *ep, term);
+ if (fflush(stdout) != 0)
+ err(1, "stdout");
exit(0);
}
diff --git a/usr.bin/env/tests/env_test.sh b/usr.bin/env/tests/env_test.sh
--- a/usr.bin/env/tests/env_test.sh
+++ b/usr.bin/env/tests/env_test.sh
@@ -123,6 +123,20 @@
env -C "${subdir}" pwd
}
+atf_test_case stdout
+stdout_head() {
+ atf_set descr "Failure to write to stdout"
+}
+stdout_body() {
+ (
+ trap "" PIPE
+ env 2>stderr
+ echo $? >result
+ ) | true
+ atf_check -o inline:"1\n" cat result
+ atf_check -o match:"stdout" cat stderr
+}
+
atf_init_test_cases()
{
atf_add_test_case basic
@@ -133,4 +147,5 @@
atf_add_test_case altpath
atf_add_test_case equal
atf_add_test_case chdir
+ atf_add_test_case stdout
}

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 19, 6:35 AM (7 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23914291
Default Alt Text
D47009.id144469.diff (894 B)

Event Timeline