summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-10-17 10:44:39 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2010-10-17 10:44:39 (GMT)
commit786635e62e4c8a8646d01ede1c7bb98ce604c7fa (patch)
tree756b03831ca4ee0aea9e542217975eee46102a3e
parentad8def2d8ad980a5b759c32a220828ea1248e5b6 (diff)
downloadbusybox-786635e62e4c8a8646d01ede1c7bb98ce604c7fa.tar.gz
busybox-786635e62e4c8a8646d01ede1c7bb98ce604c7fa.tar.bz2
seq: exit on write errors
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/seq.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/coreutils/seq.c b/coreutils/seq.c
index 8be2536..22bf3ec 100644
--- a/coreutils/seq.c
+++ b/coreutils/seq.c
@@ -86,7 +86,8 @@ int seq_main(int argc, char **argv)
v = first;
n = 0;
while (increment >= 0 ? v <= last : v >= last) {
- printf("%s%0*.*f", sep, width, frac_part, v);
+ if (printf("%s%0*.*f", sep, width, frac_part, v) < 0)
+ break; /* I/O error, bail out (yes, this really happens) */
sep = opt_s;
/* v += increment; - would accumulate floating point errors */
n++;