From 6937487be73cd4563b876413277a295a5fe2f32c Mon Sep 17 00:00:00 2001 From: James Byrne Date: Tue, 2 Jul 2019 11:35:03 +0200 Subject: libbb: reduce the overhead of single parameter bb_error_msg() calls Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne Signed-off-by: Denys Vlasenko --- archival/bbunzip.c | 2 +- archival/bzip2.c | 4 ++-- archival/dpkg.c | 14 +++++++------- archival/gzip.c | 4 ++-- archival/libarchive/data_extract_all.c | 4 ++-- archival/libarchive/decompress_bunzip2.c | 2 +- archival/libarchive/decompress_gunzip.c | 14 +++++++------- archival/libarchive/decompress_uncompress.c | 10 +++++----- archival/libarchive/decompress_unlzma.c | 6 +++--- archival/libarchive/decompress_unxz.c | 4 ++-- archival/libarchive/get_header_ar.c | 8 ++++---- archival/libarchive/get_header_cpio.c | 6 +++--- archival/libarchive/get_header_tar.c | 14 +++++++------- archival/libarchive/open_transformer.c | 6 +++--- archival/libarchive/seek_by_jump.c | 2 +- archival/libarchive/unpack_ar_archive.c | 2 +- archival/lzop.c | 14 +++++++------- archival/rpm.c | 2 +- archival/tar.c | 10 +++++----- archival/unzip.c | 18 +++++++++--------- 20 files changed, 73 insertions(+), 73 deletions(-) (limited to 'archival') diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 93f30d324..d31aaf7f3 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c @@ -114,7 +114,7 @@ int FAST_FUNC bbunpack(char **argv, /* Check that the input is sane */ if (!(option_mask32 & BBUNPK_OPT_FORCE) && isatty(STDIN_FILENO)) { - bb_error_msg_and_die("compressed data not read from terminal, " + bb_simple_error_msg_and_die("compressed data not read from terminal, " "use -f to force it"); } diff --git a/archival/bzip2.c b/archival/bzip2.c index 38cc0219a..d0390a92a 100644 --- a/archival/bzip2.c +++ b/archival/bzip2.c @@ -145,7 +145,7 @@ IF_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, vo if (n2 != n) { if (n2 >= 0) errno = 0; /* prevent bogus error message */ - bb_perror_msg(n2 >= 0 ? "short write" : bb_msg_write_error); + bb_simple_perror_msg(n2 >= 0 ? "short write" : bb_msg_write_error); return -1; } } @@ -187,7 +187,7 @@ IF_DESKTOP(long long) int FAST_FUNC compressStream(transformer_state_t *xstate U while (1) { count = full_read(STDIN_FILENO, rbuf, IOBUF_SIZE); if (count < 0) { - bb_perror_msg(bb_msg_read_error); + bb_simple_perror_msg(bb_msg_read_error); total = -1; break; } diff --git a/archival/dpkg.c b/archival/dpkg.c index ddb5daf09..da77fba05 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -487,7 +487,7 @@ static void add_split_dependencies(common_node_t *parent_node, const char *whole } else if (strncmp(version, ">=", offset_ch) == 0) { edge->operator = VER_MORE_EQUAL; } else { - bb_error_msg_and_die("illegal operator"); + bb_simple_error_msg_and_die("illegal operator"); } } /* skip to start of version numbers */ @@ -730,7 +730,7 @@ static void set_status(const unsigned status_node_num, const char *new_value, co status = new_value_num; break; default: - bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen"); + bb_simple_error_msg_and_die("DEBUG ONLY: this shouldnt happen"); } new_status = xasprintf("%s %s %s", name_hashtable[want], name_hashtable[flag], name_hashtable[status]); @@ -944,10 +944,10 @@ static void write_status_file(deb_file_t **deb_file) /* Create a separate backfile to dpkg */ if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) { if (errno != ENOENT) - bb_error_msg_and_die("can't create backup status file"); + bb_simple_error_msg_and_die("can't create backup status file"); /* Its ok if renaming the status file fails because status * file doesn't exist, maybe we are starting from scratch */ - bb_error_msg("no status file found, creating new one"); + bb_simple_error_msg("no status file found, creating new one"); } xrename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status"); @@ -1816,7 +1816,7 @@ int dpkg_main(int argc UNUSED_PARAM, char **argv) init_archive_deb_control(archive_handle); deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list); if (deb_file[deb_count]->control_file == NULL) { - bb_error_msg_and_die("can't extract control file"); + bb_simple_error_msg_and_die("can't extract control file"); } deb_file[deb_count]->filename = xstrdup(argv[0]); package_num = fill_package_struct(deb_file[deb_count]->control_file); @@ -1879,13 +1879,13 @@ int dpkg_main(int argc UNUSED_PARAM, char **argv) argv++; } if (!deb_count) - bb_error_msg_and_die("no package files specified"); + bb_simple_error_msg_and_die("no package files specified"); deb_file[deb_count] = NULL; /* Check that the deb file arguments are installable */ if (!(opt & OPT_force_ignore_depends)) { if (!check_deps(deb_file, 0 /*, deb_count*/)) { - bb_error_msg_and_die("dependency check failed"); + bb_simple_error_msg_and_die("dependency check failed"); } } diff --git a/archival/gzip.c b/archival/gzip.c index 12c1df242..17341de45 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -99,7 +99,7 @@ aa: 85.1% -- replaced with aa.gz /* Diagnostic functions */ #ifdef DEBUG static int verbose; -# define Assert(cond,msg) { if (!(cond)) bb_error_msg(msg); } +# define Assert(cond,msg) { if (!(cond)) bb_simple_error_msg(msg); } # define Trace(x) fprintf x # define Tracev(x) {if (verbose) fprintf x; } # define Tracevv(x) {if (verbose > 1) fprintf x; } @@ -787,7 +787,7 @@ static void check_match(IPos start, IPos match, int length) /* check that the match is indeed a match */ if (memcmp(G1.window + match, G1.window + start, length) != 0) { bb_error_msg(" start %d, match %d, length %d", start, match, length); - bb_error_msg("invalid match"); + bb_simple_error_msg("invalid match"); } if (verbose > 1) { bb_error_msg("\\[%d,%d]", start - match, length); diff --git a/archival/libarchive/data_extract_all.c b/archival/libarchive/data_extract_all.c index 4c95db4a6..3142405a3 100644 --- a/archival/libarchive/data_extract_all.c +++ b/archival/libarchive/data_extract_all.c @@ -103,7 +103,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle) struct stat existing_sb; if (lstat(dst_name, &existing_sb) == -1) { if (errno != ENOENT) { - bb_perror_msg_and_die("can't stat old file"); + bb_simple_perror_msg_and_die("can't stat old file"); } } else if (existing_sb.st_mtime >= file_header->mtime) { @@ -207,7 +207,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle) } break; default: - bb_error_msg_and_die("unrecognized file type"); + bb_simple_error_msg_and_die("unrecognized file type"); } if (!S_ISLNK(file_header->mode)) { diff --git a/archival/libarchive/decompress_bunzip2.c b/archival/libarchive/decompress_bunzip2.c index 1f535b32a..42e2b4f88 100644 --- a/archival/libarchive/decompress_bunzip2.c +++ b/archival/libarchive/decompress_bunzip2.c @@ -817,7 +817,7 @@ unpack_bz2_stream(transformer_state_t *xstate) break; } if (bd->headerCRC != bd->totalCRC) { - bb_error_msg("CRC error"); + bb_simple_error_msg("CRC error"); break; } diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c index 7f9046b82..1ddce610c 100644 --- a/archival/libarchive/decompress_gunzip.c +++ b/archival/libarchive/decompress_gunzip.c @@ -1012,7 +1012,7 @@ inflate_unzip_internal(STATE_PARAM transformer_state_t *xstate) error_msg = "corrupted data"; if (setjmp(error_jmp)) { /* Error from deep inside zip machinery */ - bb_error_msg(error_msg); + bb_simple_error_msg(error_msg); n = -1; goto ret; } @@ -1085,7 +1085,7 @@ static int top_up(STATE_PARAM unsigned n) bytebuffer_offset = 0; bytebuffer_size = full_read(gunzip_src_fd, &bytebuffer[count], bytebuffer_max - count); if ((int)bytebuffer_size < 0) { - bb_error_msg(bb_msg_read_error); + bb_simple_error_msg(bb_msg_read_error); return 0; } bytebuffer_size += count; @@ -1211,7 +1211,7 @@ unpack_gz_stream(transformer_state_t *xstate) if (full_read(xstate->src_fd, &magic2, 2) != 2) { bad_magic: - bb_error_msg("invalid magic"); + bb_simple_error_msg("invalid magic"); return -1; } if (magic2 == COMPRESS_MAGIC) { @@ -1233,7 +1233,7 @@ unpack_gz_stream(transformer_state_t *xstate) again: if (!check_header_gzip(PASS_STATE xstate)) { - bb_error_msg("corrupted data"); + bb_simple_error_msg("corrupted data"); total = -1; goto ret; } @@ -1246,7 +1246,7 @@ unpack_gz_stream(transformer_state_t *xstate) total += n; if (!top_up(PASS_STATE 8)) { - bb_error_msg("corrupted data"); + bb_simple_error_msg("corrupted data"); total = -1; goto ret; } @@ -1254,7 +1254,7 @@ unpack_gz_stream(transformer_state_t *xstate) /* Validate decompression - crc */ v32 = buffer_read_le_u32(PASS_STATE_ONLY); if ((~gunzip_crc) != v32) { - bb_error_msg("crc error"); + bb_simple_error_msg("crc error"); total = -1; goto ret; } @@ -1262,7 +1262,7 @@ unpack_gz_stream(transformer_state_t *xstate) /* Validate decompression - size */ v32 = buffer_read_le_u32(PASS_STATE_ONLY); if ((uint32_t)gunzip_bytes_out != v32) { - bb_error_msg("incorrect length"); + bb_simple_error_msg("incorrect length"); total = -1; } diff --git a/archival/libarchive/decompress_uncompress.c b/archival/libarchive/decompress_uncompress.c index 1517559c6..2725a7f09 100644 --- a/archival/libarchive/decompress_uncompress.c +++ b/archival/libarchive/decompress_uncompress.c @@ -113,7 +113,7 @@ unpack_Z_stream(transformer_state_t *xstate) /* xread isn't good here, we have to return - caller may want * to do some cleanup (e.g. delete incomplete unpacked file etc) */ if (full_read(xstate->src_fd, inbuf, 1) != 1) { - bb_error_msg("short read"); + bb_simple_error_msg("short read"); goto err; } @@ -166,7 +166,7 @@ unpack_Z_stream(transformer_state_t *xstate) if (insize < (int) (IBUFSIZ + 64) - IBUFSIZ) { rsize = safe_read(xstate->src_fd, inbuf + insize, IBUFSIZ); if (rsize < 0) - bb_error_msg_and_die(bb_msg_read_error); + bb_simple_error_msg_and_die(bb_msg_read_error); insize += rsize; } @@ -200,7 +200,7 @@ unpack_Z_stream(transformer_state_t *xstate) if (oldcode == -1) { if (code >= 256) - bb_error_msg_and_die("corrupted data"); /* %ld", code); */ + bb_simple_error_msg_and_die("corrupted data"); /* %ld", code); */ oldcode = code; finchar = (int) oldcode; outbuf[outpos++] = (unsigned char) finchar; @@ -236,7 +236,7 @@ unpack_Z_stream(transformer_state_t *xstate) insize, posbits, p[-1], p[0], p[1], p[2], p[3], (posbits & 07)); */ - bb_error_msg("corrupted data"); + bb_simple_error_msg("corrupted data"); goto err; } @@ -247,7 +247,7 @@ unpack_Z_stream(transformer_state_t *xstate) /* Generate output characters in reverse order */ while (code >= 256) { if (stackp <= &htabof(0)) - bb_error_msg_and_die("corrupted data"); + bb_simple_error_msg_and_die("corrupted data"); *--stackp = tab_suffixof(code); code = tab_prefixof(code); } diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c index 668b01618..0744f231a 100644 --- a/archival/libarchive/decompress_unlzma.c +++ b/archival/libarchive/decompress_unlzma.c @@ -59,7 +59,7 @@ static void rc_read(rc_t *rc) //TODO: return -1 instead //This will make unlzma delete broken unpacked file on unpack errors if (buffer_size <= 0) - bb_error_msg_and_die("unexpected EOF"); + bb_simple_error_msg_and_die("unexpected EOF"); rc->buffer_end = RC_BUFFER + buffer_size; rc->ptr = RC_BUFFER; } @@ -234,7 +234,7 @@ unpack_lzma_stream(transformer_state_t *xstate) if (full_read(xstate->src_fd, &header, sizeof(header)) != sizeof(header) || header.pos >= (9 * 5 * 5) ) { - bb_error_msg("bad lzma header"); + bb_simple_error_msg("bad lzma header"); return -1; } @@ -513,7 +513,7 @@ unpack_lzma_stream(transformer_state_t *xstate) * potentially more detailed information). * Do not fail silently. */ - bb_error_msg("corrupted data"); + bb_simple_error_msg("corrupted data"); total_written = -1; /* failure */ } rc_free(rc); diff --git a/archival/libarchive/decompress_unxz.c b/archival/libarchive/decompress_unxz.c index 8ae7a275b..f03341384 100644 --- a/archival/libarchive/decompress_unxz.c +++ b/archival/libarchive/decompress_unxz.c @@ -74,7 +74,7 @@ unpack_xz_stream(transformer_state_t *xstate) if (iobuf.in_pos == iobuf.in_size) { int rd = safe_read(xstate->src_fd, membuf, BUFSIZ); if (rd < 0) { - bb_error_msg(bb_msg_read_error); + bb_simple_error_msg(bb_msg_read_error); total = -1; break; } @@ -123,7 +123,7 @@ unpack_xz_stream(transformer_state_t *xstate) continue; } if (xz_result != XZ_OK && xz_result != XZ_UNSUPPORTED_CHECK) { - bb_error_msg("corrupted data"); + bb_simple_error_msg("corrupted data"); total = -1; break; } diff --git a/archival/libarchive/get_header_ar.c b/archival/libarchive/get_header_ar.c index 7ce9c615c..b6ecd596c 100644 --- a/archival/libarchive/get_header_ar.c +++ b/archival/libarchive/get_header_ar.c @@ -22,7 +22,7 @@ static unsigned read_num(char *str, int base, int len) * on misformatted numbers bb_strtou returns all-ones */ err = bb_strtou(str, NULL, base); if (err == -1) - bb_error_msg_and_die("invalid ar header"); + bb_simple_error_msg_and_die("invalid ar header"); return err; } @@ -53,7 +53,7 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle) archive_handle->offset += 60; if (ar.formatted.magic[0] != '`' || ar.formatted.magic[1] != '\n') - bb_error_msg_and_die("invalid ar header"); + bb_simple_error_msg_and_die("invalid ar header"); /* * Note that the fields MUST be read in reverse order as @@ -86,7 +86,7 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle) return get_header_ar(archive_handle); } #else - bb_error_msg_and_die("long filenames not supported"); + bb_simple_error_msg_and_die("long filenames not supported"); #endif } /* Only size is always present, the rest may be missing in @@ -107,7 +107,7 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle) long_offset = read_num(&ar.formatted.name[1], 10, sizeof(ar.formatted.name) - 1); if (long_offset >= archive_handle->ar__long_name_size) { - bb_error_msg_and_die("can't resolve long filename"); + bb_simple_error_msg_and_die("can't resolve long filename"); } typed->name = xstrdup(archive_handle->ar__long_names + long_offset); } else diff --git a/archival/libarchive/get_header_cpio.c b/archival/libarchive/get_header_cpio.c index 75fc6a406..4ad174732 100644 --- a/archival/libarchive/get_header_cpio.c +++ b/archival/libarchive/get_header_cpio.c @@ -33,14 +33,14 @@ char FAST_FUNC get_header_cpio(archive_handle_t *archive_handle) goto create_hardlinks; } if (size != 110) { - bb_error_msg_and_die("short read"); + bb_simple_error_msg_and_die("short read"); } archive_handle->offset += 110; if (!is_prefixed_with(&cpio_header[0], "07070") || (cpio_header[5] != '1' && cpio_header[5] != '2') ) { - bb_error_msg_and_die("unsupported cpio format, use newc or crc"); + bb_simple_error_msg_and_die("unsupported cpio format, use newc or crc"); } if (sscanf(cpio_header + 6, @@ -50,7 +50,7 @@ char FAST_FUNC get_header_cpio(archive_handle_t *archive_handle) &inode, &mode, &uid, &gid, &nlink, &mtime, &size, &major, &minor, &namesize) != 10) - bb_error_msg_and_die("damaged cpio file"); + bb_simple_error_msg_and_die("damaged cpio file"); file_header->mode = mode; /* "cpio -R USER:GRP" support: */ if (archive_handle->cpio__owner.uid != (uid_t)-1L) diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c index 52fa4554a..b3131ff2d 100644 --- a/archival/libarchive/get_header_tar.c +++ b/archival/libarchive/get_header_tar.c @@ -32,7 +32,7 @@ static unsigned long long getOctal(char *str, int len) if (*end != '\0' && *end != ' ') { int8_t first = str[0]; if (!(first & 0x80)) - bb_error_msg_and_die("corrupted octal value in tar header"); + bb_simple_error_msg_and_die("corrupted octal value in tar header"); /* * GNU tar uses "base-256 encoding" for very large numbers. * Encoding is binary, with highest bit always set as a marker @@ -100,7 +100,7 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g || errno != EINVAL || *end != ' ' ) { - bb_error_msg("malformed extended header, skipped"); + bb_simple_error_msg("malformed extended header, skipped"); // More verbose version: //bb_error_msg("malformed extended header at %"OFF_FMT"d, skipped", // archive_handle->offset - (sz + len)); @@ -194,13 +194,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) * the very first read fails. Grrr. */ if (archive_handle->offset == 0) - bb_error_msg("short read"); + bb_simple_error_msg("short read"); /* this merely signals end of archive, not exit(1): */ return EXIT_FAILURE; } if (i != 512) { IF_FEATURE_TAR_AUTODETECT(goto autodetect;) - bb_error_msg_and_die("short read"); + bb_simple_error_msg_and_die("short read"); } #else @@ -243,11 +243,11 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) goto err; if (setup_unzip_on_fd(archive_handle->src_fd, /*fail_if_not_compressed:*/ 0) != 0) err: - bb_error_msg_and_die("invalid tar magic"); + bb_simple_error_msg_and_die("invalid tar magic"); archive_handle->offset = 0; goto again_after_align; #endif - bb_error_msg_and_die("invalid tar magic"); + bb_simple_error_msg_and_die("invalid tar magic"); } /* Do checksum on headers. @@ -282,7 +282,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) if (sum_u != sum IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum) ) { - bb_error_msg_and_die("invalid tar header checksum"); + bb_simple_error_msg_and_die("invalid tar header checksum"); } /* GET_OCTAL trashes subsequent field, therefore we call it diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c index a90f42a45..44715ef25 100644 --- a/archival/libarchive/open_transformer.c +++ b/archival/libarchive/open_transformer.c @@ -15,7 +15,7 @@ int FAST_FUNC check_signature16(transformer_state_t *xstate, unsigned magic16) if (!xstate->signature_skipped) { uint16_t magic2; if (full_read(xstate->src_fd, &magic2, 2) != 2 || magic2 != magic16) { - bb_error_msg("invalid magic"); + bb_simple_error_msg("invalid magic"); return -1; } xstate->signature_skipped = 2; @@ -46,7 +46,7 @@ ssize_t FAST_FUNC transformer_write(transformer_state_t *xstate, const void *buf } else { nwrote = full_write(xstate->dst_fd, buf, bufsize); if (nwrote != (ssize_t)bufsize) { - bb_perror_msg("write"); + bb_simple_perror_msg("write"); nwrote = -1; goto ret; } @@ -205,7 +205,7 @@ static transformer_state_t *setup_transformer_on_fd(int fd, int fail_if_not_comp /* No known magic seen */ if (fail_if_not_compressed) - bb_error_msg_and_die("no gzip" + bb_simple_error_msg_and_die("no gzip" IF_FEATURE_SEAMLESS_BZ2("/bzip2") IF_FEATURE_SEAMLESS_XZ("/xz") " magic"); diff --git a/archival/libarchive/seek_by_jump.c b/archival/libarchive/seek_by_jump.c index 232d97e53..dddaa3732 100644 --- a/archival/libarchive/seek_by_jump.c +++ b/archival/libarchive/seek_by_jump.c @@ -13,6 +13,6 @@ void FAST_FUNC seek_by_jump(int fd, off_t amount) if (errno == ESPIPE) seek_by_read(fd, amount); else - bb_perror_msg_and_die("seek failure"); + bb_simple_perror_msg_and_die("seek failure"); } } diff --git a/archival/libarchive/unpack_ar_archive.c b/archival/libarchive/unpack_ar_archive.c index 4f9f89874..584c18ce8 100644 --- a/archival/libarchive/unpack_ar_archive.c +++ b/archival/libarchive/unpack_ar_archive.c @@ -12,7 +12,7 @@ void FAST_FUNC unpack_ar_archive(archive_handle_t *ar_archive) xread(ar_archive->src_fd, magic, AR_MAGIC_LEN); if (!is_prefixed_with(magic, AR_MAGIC)) { - bb_error_msg_and_die("invalid ar magic"); + bb_simple_error_msg_and_die("invalid ar magic"); } ar_archive->offset += AR_MAGIC_LEN; diff --git a/archival/lzop.c b/archival/lzop.c index 585632c4e..bdd21598c 100644 --- a/archival/lzop.c +++ b/archival/lzop.c @@ -752,7 +752,7 @@ static FAST_FUNC void lzo_check( */ uint32_t c = fn(init, buf, len); if (c != ref) - bb_error_msg_and_die("checksum error"); + bb_simple_error_msg_and_die("checksum error"); } /**********************************************************************/ @@ -785,15 +785,15 @@ static NOINLINE int lzo_decompress(uint32_t h_flags32) /* error if split file */ if (dst_len == 0xffffffffL) /* should not happen - not yet implemented */ - bb_error_msg_and_die("this file is a split lzop file"); + bb_simple_error_msg_and_die("this file is a split lzop file"); if (dst_len > MAX_BLOCK_SIZE) - bb_error_msg_and_die("corrupted data"); + bb_simple_error_msg_and_die("corrupted data"); /* read compressed block size */ src_len = read32(); if (src_len <= 0 || src_len > dst_len) - bb_error_msg_and_die("corrupted data"); + bb_simple_error_msg_and_die("corrupted data"); if (dst_len > block_size) { if (b2) { @@ -846,7 +846,7 @@ static NOINLINE int lzo_decompress(uint32_t h_flags32) r = lzo1x_decompress_safe(b1, src_len, b2, &d /*, NULL*/); if (r != 0 /*LZO_E_OK*/ || dst_len != d) { - bb_error_msg_and_die("corrupted data"); + bb_simple_error_msg_and_die("corrupted data"); } dst = b2; } else { @@ -913,7 +913,7 @@ static void check_magic(void) unsigned char magic[sizeof(lzop_magic)]; xread(0, magic, sizeof(magic)); if (memcmp(magic, lzop_magic, sizeof(lzop_magic)) != 0) - bb_error_msg_and_die("bad magic number"); + bb_simple_error_msg_and_die("bad magic number"); } /**********************************************************************/ @@ -1049,7 +1049,7 @@ static void lzo_set_method(header_t *h) else if (option_mask32 & OPT_8) level = 8; #else - bb_error_msg_and_die("high compression not compiled in"); + bb_simple_error_msg_and_die("high compression not compiled in"); #endif } diff --git a/archival/rpm.c b/archival/rpm.c index 95b2531e8..68afba914 100644 --- a/archival/rpm.c +++ b/archival/rpm.c @@ -543,7 +543,7 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv) } if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0) - bb_error_msg_and_die("error unpacking"); + bb_simple_error_msg_and_die("error unpacking"); if (ENABLE_FEATURE_CLEAN_UP) { close(rpm_fd); diff --git a/archival/tar.c b/archival/tar.c index 3ef89fb0a..ca802f73c 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -369,7 +369,7 @@ static int writeTarHeader(struct TarBallInfo *tbInfo, /* If it is larger than 100 bytes, bail out */ if (header.linkname[sizeof(header.linkname)-1]) { free(lpath); - bb_error_msg("names longer than "NAME_SIZE_STR" chars not supported"); + bb_simple_error_msg("names longer than "NAME_SIZE_STR" chars not supported"); return FALSE; } # endif @@ -542,7 +542,7 @@ static int FAST_FUNC writeFileToTarball(const char *fileName, struct stat *statb # if !ENABLE_FEATURE_TAR_GNU_EXTENSIONS if (strlen(header_name) >= NAME_SIZE) { - bb_error_msg("names longer than "NAME_SIZE_STR" chars not supported"); + bb_simple_error_msg("names longer than "NAME_SIZE_STR" chars not supported"); return TRUE; } # endif @@ -715,13 +715,13 @@ static NOINLINE int writeTarFile( freeHardLinkInfo(&tbInfo->hlInfoHead); if (errorFlag) - bb_error_msg("error exit delayed from previous errors"); + bb_simple_error_msg("error exit delayed from previous errors"); # if SEAMLESS_COMPRESSION if (gzip) { int status; if (safe_waitpid(-1, &status, 0) == -1) - bb_perror_msg("waitpid"); + bb_simple_perror_msg("waitpid"); else if (!WIFEXITED(status) || WEXITSTATUS(status)) /* gzip was killed or has exited with nonzero! */ errorFlag = TRUE; @@ -1150,7 +1150,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv) if (opt & OPT_CREATE) { /* Make sure there is at least one file to tar up */ if (tar_handle->accept == NULL) - bb_error_msg_and_die("empty archive"); + bb_simple_error_msg_and_die("empty archive"); tar_fd = STDOUT_FILENO; /* Mimicking GNU tar 1.15.1: */ diff --git a/archival/unzip.c b/archival/unzip.c index 466794031..8c4cb9881 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -322,7 +322,7 @@ static uint32_t read_next_cdf(uint32_t cdf_offset, cdf_header_t *cdf) static void die_if_bad_fnamesize(unsigned sz) { if (sz > 0xfff) /* more than 4k?! no funny business please */ - bb_error_msg_and_die("bad archive"); + bb_simple_error_msg_and_die("bad archive"); } static void unzip_skip(off_t skip) @@ -359,7 +359,7 @@ static void unzip_extract_symlink(llist_t **symlink_placeholders, xread(zip_fd, target, zip->fmt.ucmpsize); } else { #if 1 - bb_error_msg_and_die("compressed symlink is not supported"); + bb_simple_error_msg_and_die("compressed symlink is not supported"); #else transformer_state_t xstate; init_transformer_state(&xstate); @@ -399,10 +399,10 @@ static void unzip_extract(zip_header_t *zip, int dst_fd) if (zip->fmt.method == 8) { /* Method 8 - inflate */ if (inflate_unzip(&xstate) < 0) - bb_error_msg_and_die("inflate error"); + bb_simple_error_msg_and_die("inflate error"); /* Validate decompression - crc */ if (zip->fmt.crc32 != (xstate.crc32 ^ 0xffffffffL)) { - bb_error_msg_and_die("crc error"); + bb_simple_error_msg_and_die("crc error"); } } #if ENABLE_FEATURE_UNZIP_BZIP2 @@ -412,7 +412,7 @@ static void unzip_extract(zip_header_t *zip, int dst_fd) */ xstate.bytes_out = unpack_bz2_stream(&xstate); if (xstate.bytes_out < 0) - bb_error_msg_and_die("inflate error"); + bb_simple_error_msg_and_die("inflate error"); } #endif #if ENABLE_FEATURE_UNZIP_LZMA @@ -420,7 +420,7 @@ static void unzip_extract(zip_header_t *zip, int dst_fd) /* Not tested yet */ xstate.bytes_out = unpack_lzma_stream(&xstate); if (xstate.bytes_out < 0) - bb_error_msg_and_die("inflate error"); + bb_simple_error_msg_and_die("inflate error"); } #endif #if ENABLE_FEATURE_UNZIP_XZ @@ -428,7 +428,7 @@ static void unzip_extract(zip_header_t *zip, int dst_fd) /* Not tested yet */ xstate.bytes_out = unpack_xz_stream(&xstate); if (xstate.bytes_out < 0) - bb_error_msg_and_die("inflate error"); + bb_simple_error_msg_and_die("inflate error"); } #endif else { @@ -439,7 +439,7 @@ static void unzip_extract(zip_header_t *zip, int dst_fd) if (zip->fmt.ucmpsize != xstate.bytes_out) { /* Don't die. Who knows, maybe len calculation * was botched somewhere. After all, crc matched! */ - bb_error_msg("bad length"); + bb_simple_error_msg("bad length"); } } @@ -447,7 +447,7 @@ static void my_fgets80(char *buf80) { fflush_all(); if (!fgets(buf80, 80, stdin)) { - bb_perror_msg_and_die("can't read standard input"); + bb_simple_perror_msg_and_die("can't read standard input"); } } -- cgit v1.2.3