busybox: Clear errstr after setting errno
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 1 Mar 2018 17:10:12 +0000 (12:10 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 28 Mar 2018 20:43:05 +0000 (16:43 -0400)
Otherwise, whenever BB prints an error message, it will print an old,
confusing errstr.

This is far from exhaustive: it's just the spot I noticed it.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/apps/busybox/akaros-patches/1.17.3/0009-unset_errno.patch [new file with mode: 0644]

diff --git a/tools/apps/busybox/akaros-patches/1.17.3/0009-unset_errno.patch b/tools/apps/busybox/akaros-patches/1.17.3/0009-unset_errno.patch
new file mode 100644 (file)
index 0000000..25f56d2
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/libbb/copy_file.c        2018-03-01 12:07:42.710585231 -0500
++++ b/libbb/copy_file.c        2018-03-01 12:07:20.634470427 -0500
+@@ -335,6 +335,7 @@
+       /* We are lazy here, a bit lax with races... */
+       if (dest_exists) {
+               errno = EEXIST;
++              errstr()[0] = 0;
+               ovr = ask_and_unlink(dest, flags);
+               if (ovr <= 0)
+                       return ovr;