[PATCH] libbb: More informative "short write" error

Denys Vlasenko vda.linux at googlemail.com
Mon Sep 5 10:18:29 UTC 2016


On Sun, Sep 4, 2016 at 12:11 PM, Lauri Kasanen <curaga at operamail.com> wrote:
> Hi,
>
> Over at TinyCore, we receive a huge number of questions of the type "I
> got "short write", what does it mean?". Mostly for the rpi port and when
> using bb wget. The attached patch makes the message more informative,
> and hopefully lets more people know what's up without having to ask.

         ssize_t size = full_write(fd, buf, count);
         if ((size_t)size != count)
-            bb_error_msg_and_die("short write");
+            bb_error_msg_and_die("short write, out of disk space?");

Well, it is "disk full" only for regular files.
For pipes or network, it's "we wrote some and then pipe was closed
before we wrote out everything". For devices, it's whole slew of
possibilities.

I looked at full_write() and it can return short write
only if write syscall failed. So errno must be set.

How about just replacing bb_error_msg_and_die()
with bb_perror_msg_and_die()?


More information about the busybox mailing list