lineedit: do not hang on error, but return error indicator.
[oweals/busybox.git] / libbb / read_printf.c
index 53f528f5aa11e5e7e04c7569c03c95a46e7cabdb..7ca3d68c38728efa765bf8a44cbedc66a0f4c1e3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
  *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 #include "libbb.h"
 
@@ -265,7 +265,7 @@ void FAST_FUNC setup_unzip_on_fd(int fd /*, int fail_if_not_detected*/)
 
        /* .gz and .bz2 both have 2-byte signature, and their
         * unpack_XXX_stream wants this header skipped. */
-       xread(fd, magic.b16, sizeof(magic.b16));
+       xread(fd, magic.b16, sizeof(magic.b16[0]));
        if (ENABLE_FEATURE_SEAMLESS_GZ
         && magic.b16[0] == GZIP_MAGIC
        ) {
@@ -289,15 +289,13 @@ void FAST_FUNC setup_unzip_on_fd(int fd /*, int fail_if_not_detected*/)
        if (ENABLE_FEATURE_SEAMLESS_XZ
         && magic.b16[0] == XZ_MAGIC1
        ) {
-               /* .xz signature: 0xfd, '7', 'z', 'X', 'Z', 0x00 */
-               /* More info at: http://tukaani.org/xz/xz-file-format.txt */
                offset = -6;
-               xread(fd, magic.b32, sizeof(magic.b32));
+               xread(fd, magic.b32, sizeof(magic.b32[0]));
                if (magic.b32[0] == XZ_MAGIC2) {
 # if BB_MMU
                        xformer = unpack_xz_stream;
-                       /* unpack_xz_stream wants fd at position 0 */
-                       xlseek(fd, offset, SEEK_CUR);
+                       /* unpack_xz_stream wants fd at position 6, no need to seek */
+                       //xlseek(fd, offset, SEEK_CUR);
 # else
                        xformer_prog = "unxz";
 # endif