Page MenuHomeFreeBSD

D47009.id144501.diff
No OneTemporary

D47009.id144501.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
@@ -214,6 +214,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
@@ -130,6 +130,22 @@
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
@@ -140,4 +156,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, Feb 8, 5:00 PM (12 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28475575
Default Alt Text
D47009.id144501.diff (896 B)

Event Timeline