Page MenuHomeFreeBSD

D55227.diff
No OneTemporary

D55227.diff

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

Mime Type
text/plain
Expires
Mon, Jul 20, 3:04 AM (13 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35250317
Default Alt Text
D55227.diff (922 B)

Event Timeline