Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162977969
D55227.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
922 B
Referenced Files
None
Subscribers
None
D55227.diff
View Options
diff --git a/bin/pwd/pwd.c b/bin/pwd/pwd.c
--- a/bin/pwd/pwd.c
+++ b/bin/pwd/pwd.c
@@ -112,5 +112,7 @@
printf("%s\n", pwd);
else
err(1, ".");
+ if (fflush(stdout) != 0)
+ err(1, "stdout");
exit(0);
}
diff --git a/bin/pwd/tests/pwd_test.sh b/bin/pwd/tests/pwd_test.sh
--- a/bin/pwd/tests/pwd_test.sh
+++ b/bin/pwd/tests/pwd_test.sh
@@ -66,8 +66,29 @@
atf_check -o inline:"$root/phy/baz\n" pwd -L
}
+atf_test_case stdout
+stdout_head()
+{
+ atf_set descr "error writing to stdout"
+}
+stdout_body()
+{
+ pwd=$(which pwd)
+ [ -f "$pwd" ] || atf_skip "unable to distinguish binary from builtin"
+ (
+ trap "" PIPE
+ # Give true(1) some time to exit.
+ sleep 1
+ $pwd 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 logical
atf_add_test_case physical
+ atf_add_test_case stdout
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jul 19, 9:07 PM (7 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35250317
Default Alt Text
D55227.diff (922 B)
Attached To
Mode
D55227: pwd: Error out if writing to stdout failed
Attached
Detach File
Event Timeline
Log In to Comment