Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F132594328
D47009.id144469.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
894 B
Referenced Files
None
Subscribers
None
D47009.id144469.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D47009: env: Check the status of stdout.
Attached
Detach File
Event Timeline
Log In to Comment