diff options
author | Cem Keylan <cem@ckyln.com> | 2021-03-09 08:43:43 +0300 |
---|---|---|
committer | Cem Keylan <cem@ckyln.com> | 2021-03-09 08:43:43 +0300 |
commit | 7ccc9c2432a847b85da5f445977d09f014cbc75b (patch) | |
tree | 8067d45ebeea60f1ddaa8167cb1398e2b6631473 /coreutils | |
parent | fef526c380e35cbdc0bdb8375487756c42659a75 (diff) | |
parent | 307cd26e9893ed0cf6ee88e7fca2d61d3da0e139 (diff) | |
download | busybox-7ccc9c2432a847b85da5f445977d09f014cbc75b.tar.gz |
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/echo.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/coreutils/echo.c b/coreutils/echo.c index b3828894c..61ba060ec 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c @@ -97,6 +97,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv) #else char nflag = 1; char eflag = 0; + int err; while ((arg = *++argv) != NULL) { char n, e; @@ -185,13 +186,12 @@ int echo_main(int argc UNUSED_PARAM, char **argv) do_write: /* Careful to error out on partial writes too (think ENOSPC!) */ errno = 0; - /*r =*/ full_write(STDOUT_FILENO, buffer, out - buffer); - free(buffer); - if (/*WRONG:r < 0*/ errno) { + err = full_write(STDOUT_FILENO, buffer, out - buffer) != out - buffer; + if (err) { bb_simple_perror_msg(bb_msg_write_error); - return 1; } - return 0; + free(buffer); + return err; } /* |