Page MenuHomeFreeBSD

D56402.id175545.diff
No OneTemporary

D56402.id175545.diff

diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -35,7 +35,7 @@
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
-#include <err.h>
+
#include <errno.h>
#include <fnmatch.h>
#include <fts.h>
@@ -241,7 +241,7 @@
if (sflag)
depth = 0;
- if (!*argv) {
+ if (argc == 0) {
argv = save;
argv[0] = dot;
argv[1] = NULL;
@@ -264,8 +264,7 @@
(void)signal(SIGINFO, siginfo);
if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL)
- err(1, "fts_open");
-
+ xo_err(1, "fts_open");
xo_set_version(DU_XO_VERSION);
xo_open_container("disk-usage-information");
@@ -364,7 +363,7 @@
number_buckets = links_hash_initial_size;
buckets = malloc(number_buckets * sizeof(buckets[0]));
if (buckets == NULL)
- errx(1, "No memory for hardlink detection");
+ xo_errx(1, "No memory for hardlink detection");
for (i = 0; i < number_buckets; i++)
buckets[i] = NULL;
}
@@ -502,10 +501,10 @@
ign = calloc(1, sizeof(*ign));
if (ign == NULL)
- errx(1, "cannot allocate memory");
+ xo_errx(1, "cannot allocate memory");
ign->mask = strdup(mask);
if (ign->mask == NULL)
- errx(1, "cannot allocate memory");
+ xo_errx(1, "cannot allocate memory");
SLIST_INSERT_HEAD(&ignores, ign, next);
}
diff --git a/usr.bin/du/tests/du_test.sh b/usr.bin/du/tests/du_test.sh
--- a/usr.bin/du/tests/du_test.sh
+++ b/usr.bin/du/tests/du_test.sh
@@ -295,6 +295,21 @@
sort du.out
}
+atf_test_case stdout
+stdout_head() {
+ atf_set descr "Failure to write to stdout"
+}
+stdout_body() {
+ (
+ trap "" PIPE
+ sleep 1
+ du 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 A_flag
@@ -314,4 +329,5 @@
atf_add_test_case s_flag
atf_add_test_case si_flag
atf_add_test_case t_flag
+ atf_add_test_case stdout
}

File Metadata

Mime Type
text/plain
Expires
Fri, May 15, 2:41 AM (4 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33070964
Default Alt Text
D56402.id175545.diff (1 KB)

Event Timeline