libbb: reduce the overhead of single parameter bb_error_msg() calls
authorJames Byrne <james.byrne@origamienergy.com>
Tue, 2 Jul 2019 09:35:03 +0000 (11:35 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 2 Jul 2019 09:35:03 +0000 (11:35 +0200)
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 <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
225 files changed:
Config.in
archival/bbunzip.c
archival/bzip2.c
archival/dpkg.c
archival/gzip.c
archival/libarchive/data_extract_all.c
archival/libarchive/decompress_bunzip2.c
archival/libarchive/decompress_gunzip.c
archival/libarchive/decompress_uncompress.c
archival/libarchive/decompress_unlzma.c
archival/libarchive/decompress_unxz.c
archival/libarchive/get_header_ar.c
archival/libarchive/get_header_cpio.c
archival/libarchive/get_header_tar.c
archival/libarchive/open_transformer.c
archival/libarchive/seek_by_jump.c
archival/libarchive/unpack_ar_archive.c
archival/lzop.c
archival/rpm.c
archival/tar.c
archival/unzip.c
console-tools/loadfont.c
console-tools/loadkmap.c
console-tools/openvt.c
console-tools/showkey.c
coreutils/cp.c
coreutils/cut.c
coreutils/date.c
coreutils/df.c
coreutils/echo.c
coreutils/env.c
coreutils/expand.c
coreutils/expr.c
coreutils/id.c
coreutils/install.c
coreutils/ln.c
coreutils/logname.c
coreutils/md5_sha1_sum.c
coreutils/od_bloaty.c
coreutils/paste.c
coreutils/printf.c
coreutils/rm.c
coreutils/sort.c
coreutils/split.c
coreutils/stty.c
coreutils/tail.c
coreutils/test.c
coreutils/tr.c
coreutils/uudecode.c
coreutils/uuencode.c
debianutils/start_stop_daemon.c
e2fsprogs/chattr.c
e2fsprogs/fsck.c
editors/awk.c
editors/diff.c
editors/ed.c
editors/patch_bbox.c
editors/patch_toybox.c
editors/sed.c
editors/vi.c
findutils/find.c
findutils/xargs.c
include/libbb.h
init/bootchartd.c
init/init.c
libbb/appletlib.c
libbb/bb_getgroups.c
libbb/bbunit.c
libbb/capability.c
libbb/change_identity.c
libbb/copy_file.c
libbb/copyfd.c
libbb/die_if_bad_username.c
libbb/dump.c
libbb/fflush_stdout_and_exit.c
libbb/get_console.c
libbb/get_volsize.c
libbb/getpty.c
libbb/herror_msg.c
libbb/mtab.c
libbb/perror_nomsg.c
libbb/perror_nomsg_and_die.c
libbb/read_printf.c
libbb/safe_poll.c
libbb/selinux_common.c
libbb/time.c
libbb/update_passwd.c
libbb/uuencode.c
libbb/verror_msg.c
libbb/warn_ignoring_args.c
libbb/xconnect.c
libbb/xfuncs.c
libbb/xfuncs_printf.c
libbb/xgetcwd.c
libbb/xgethostbyname.c
loginutils/addgroup.c
loginutils/adduser.c
loginutils/chpasswd.c
loginutils/deluser.c
loginutils/getty.c
loginutils/login.c
loginutils/su.c
loginutils/sulogin.c
mailutils/mail.c
mailutils/popmaildir.c
mailutils/sendmail.c
miscutils/bc.c
miscutils/chat.c
miscutils/crond.c
miscutils/crontab.c
miscutils/dc.c
miscutils/devfsd.c
miscutils/devmem.c
miscutils/fbsplash.c
miscutils/flash_eraseall.c
miscutils/hdparm.c
miscutils/hexedit.c
miscutils/i2c_tools.c
miscutils/inotifyd.c
miscutils/nandwrite.c
miscutils/rfkill.c
miscutils/rx.c
miscutils/time.c
miscutils/ubi_tools.c
miscutils/ubirename.c
modutils/modutils-24.c
modutils/rmmod.c
networking/arp.c
networking/arping.c
networking/dnsd.c
networking/ether-wake.c
networking/ftpgetput.c
networking/hostname.c
networking/httpd.c
networking/ifconfig.c
networking/ifplugd.c
networking/ifupdown.c
networking/inetd.c
networking/ipcalc.c
networking/isrv.c
networking/libiproute/ipaddress.c
networking/libiproute/ipneigh.c
networking/libiproute/iproute.c
networking/libiproute/iptunnel.c
networking/libiproute/libnetlink.c
networking/libiproute/utils.c
networking/nbd-client.c
networking/nc.c
networking/nc_bloaty.c
networking/netstat.c
networking/nslookup.c
networking/ntpd.c
networking/ping.c
networking/route.c
networking/slattach.c
networking/tcpudp.c
networking/telnetd.c
networking/tftp.c
networking/tls.c
networking/tls.h
networking/traceroute.c
networking/udhcp/arpping.c
networking/udhcp/common.c
networking/udhcp/common.h
networking/udhcp/d6_dhcpc.c
networking/udhcp/d6_packet.c
networking/udhcp/d6_socket.c
networking/udhcp/dhcpc.c
networking/udhcp/dhcpd.c
networking/udhcp/dhcprelay.c
networking/udhcp/packet.c
networking/udhcp/signalpipe.c
networking/udhcp/socket.c
networking/wget.c
networking/zcip.c
printutils/lpr.c
procps/kill.c
procps/mpstat.c
procps/powertop.c
procps/pstree.c
procps/top.c
runit/chpst.c
runit/svlogd.c
selinux/chcon.c
selinux/getenforce.c
selinux/getsebool.c
selinux/load_policy.c
selinux/runcon.c
selinux/sestatus.c
selinux/setenforce.c
selinux/setfiles.c
selinux/setsebool.c
shell/hush.c
shell/shell_common.c
sysklogd/klogd.c
sysklogd/logread.c
sysklogd/syslogd.c
util-linux/acpid.c
util-linux/dmesg.c
util-linux/eject.c
util-linux/fdformat.c
util-linux/fdisk.c
util-linux/flock.c
util-linux/fsck_minix.c
util-linux/getopt.c
util-linux/hwclock.c
util-linux/ipcs.c
util-linux/last.c
util-linux/losetup.c
util-linux/mdev.c
util-linux/mesg.c
util-linux/mkfs_ext2.c
util-linux/mkfs_minix.c
util-linux/mkfs_reiser.c
util-linux/mkfs_vfat.c
util-linux/mkswap.c
util-linux/mount.c
util-linux/nsenter.c
util-linux/rdate.c
util-linux/readprofile.c
util-linux/rtcwake.c
util-linux/setpriv.c
util-linux/switch_root.c
util-linux/uevent.c
util-linux/unshare.c

index 1a726f0433fa9c43425ffa8d2b7942a14e2e592c..14f54aacca1765d98acb55eca42715a9202d786a 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -661,6 +661,19 @@ config WERROR
 
        Most people should answer N.
 
+config WARN_SIMPLE_MSG
+       bool "Warn about single parameter bb_xx_msg calls"
+       default n
+       help
+       This will cause warnings to be shown for any instances of
+       bb_error_msg(), bb_error_msg_and_die(), bb_perror_msg(),
+       bb_perror_msg_and_die(), bb_herror_msg() or bb_herror_msg_and_die()
+       being called with a single parameter. In these cases the equivalent
+       bb_simple_xx_msg function should be used instead.
+       Note that use of STRERROR_FMT may give false positives.
+
+       If you aren't developing busybox, say N here.
+
 choice
        prompt "Additional debugging library"
        default NO_DEBUG_LIB
index 93f30d3245fc06969cbfcc524bab86ff6e86f66c..d31aaf7f377945fc8850ac86c997d9bc43408549 100644 (file)
@@ -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");
                }
 
index 38cc0219aa3c5779e4d0a53ea6f3f00360a2e593..d0390a92ac2fc15485deda751a69722f1a954053 100644 (file)
@@ -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;
                }
index ddb5daf0972a8fde9bd2c0e1eb661965e93af3d3..da77fba05f8cfc22d73a4ed121c6583087f86f50 100644 (file)
@@ -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");
                }
        }
 
index 12c1df242a99e627cca25c0d56c7f2f564a8b37d..17341de45790c49565b259ff35bd883ef1a3b780 100644 (file)
@@ -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);
index 4c95db4a66dfbe2f171c81664bd4b0293471160c..3142405a330007e96f933c3e41930d38dd95c99f 100644 (file)
@@ -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)) {
index 1f535b32a033926e089c2c9348652c15228fc8f1..42e2b4f880bab16d175b2466b16d99bfc0442169 100644 (file)
@@ -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;
                }
 
index 7f9046b82b98d881b66b9537b681dc9a9e5bc691..1ddce610c286ecd59de3b9e470284d115bc34f4e 100644 (file)
@@ -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;
        }
 
index 1517559c64c353429adf9bc850da81758d28ba58..2725a7f097f54ddf3b099758b479bc3a61f96884 100644 (file)
@@ -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);
                        }
index 668b0161813affec3ba31141ca25e0b1867c10d2..0744f231a1d64d92676b0cada2342f88f3b39b31 100644 (file)
@@ -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);
index 8ae7a275bfd71cfa4f563a0168e075e55fc07a5c..f0334138457b70372d969aa7d405cff0e52f022e 100644 (file)
@@ -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;
                }
index 7ce9c615c69661bd6f9b5055390cab4cf3b74a5e..b6ecd596ca177f074beccfb7b73a18c86cf8f238 100644 (file)
@@ -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
index 75fc6a4067982370760759e5aba96788d08d7191..4ad174732f58f3fa94ed1afc89a7e37bacd69338 100644 (file)
@@ -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)
index 52fa4554abfcc26630f05310dd57a28a380f2720..b3131ff2dce13b8eb39313a33ea235975035f8e4 100644 (file)
@@ -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
index a90f42a4581a1055460f94fbf81538bdd6852374..44715ef25236aad3aa84fa6ac3955cfe5ff99a4f 100644 (file)
@@ -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");
index 232d97e53698bd6f5eff09e64fa9327f37cb5929..dddaa37328c14f61548a80622486c01539dc7795 100644 (file)
@@ -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");
        }
 }
index 4f9f89874cc31b0f1f401831843713a3cd124606..584c18ce858a77207f510d28339d337d0b21dcca 100644 (file)
@@ -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;
 
index 585632c4e52829ae5f49ee8c18d2e48b69d2ea60..bdd21598c29b6a7f5d0d0648e0eb3ae719bbdb8b 100644 (file)
@@ -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
        }
 
index 95b2531e8ffa1b3aff0e331ad4c5dc13635ded28..68afba9144800c84e573c6c4f10ec71663b89bbe 100644 (file)
@@ -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);
index 3ef89fb0a2df63e6822b45b9c6c57d758875731a..ca802f73ca8ab92b603e75d81639233fb5438223 100644 (file)
@@ -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: */
index 466794031852a713db7e0242c10b052d4cf96086..8c4cb9881bf565184490c5a8126f4fd1a65c8ad3 100644 (file)
@@ -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");
        }
 }
 
index b5d4e8f436865f2bd15f5644b638ae67c37bfb3d..caad7d9ac3bfd7b74bd0bfc3376d061b60797234 100644 (file)
@@ -225,7 +225,7 @@ static void do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize,
                                if (unicode == PSF2_SEPARATOR) {
                                        break;
                                } else if (unicode == PSF2_STARTSEQ) {
-                                       bb_error_msg_and_die("unicode sequences not implemented");
+                                       bb_simple_error_msg_and_die("unicode sequences not implemented");
                                } else if (unicode >= 0xC0) {
                                        if (unicode >= 0xFC)
                                                unicode &= 0x01, maxct = 5;
@@ -239,12 +239,12 @@ static void do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize,
                                                unicode &= 0x1F, maxct = 1;
                                        do {
                                                if (tailsz <= 0 || *inbuf < 0x80 || *inbuf > 0xBF)
-                                                       bb_error_msg_and_die("illegal UTF-8 character");
+                                                       bb_simple_error_msg_and_die("illegal UTF-8 character");
                                                --tailsz;
                                                unicode = (unicode << 6) + (*inbuf++ & 0x3F);
                                        } while (--maxct > 0);
                                } else if (unicode >= 0x80) {
-                                       bb_error_msg_and_die("illegal UTF-8 character");
+                                       bb_simple_error_msg_and_die("illegal UTF-8 character");
                                }
 #else
                                return;
@@ -281,7 +281,7 @@ static void do_load(int fd, unsigned char *buffer, size_t len)
 
        if (len >= sizeof(struct psf1_header) && PSF1_MAGIC_OK(psf1h(buffer))) {
                if (psf1h(buffer)->mode > PSF1_MAXMODE)
-                       bb_error_msg_and_die("unsupported psf file mode");
+                       bb_simple_error_msg_and_die("unsupported psf file mode");
                if (psf1h(buffer)->mode & PSF1_MODE512)
                        fontsize = 512;
                if (psf1h(buffer)->mode & PSF1_MODEHASTAB)
@@ -292,7 +292,7 @@ static void do_load(int fd, unsigned char *buffer, size_t len)
 #if ENABLE_FEATURE_LOADFONT_PSF2
        if (len >= sizeof(struct psf2_header) && PSF2_MAGIC_OK(psf2h(buffer))) {
                if (psf2h(buffer)->version > PSF2_MAXVERSION)
-                       bb_error_msg_and_die("unsupported psf file version");
+                       bb_simple_error_msg_and_die("unsupported psf file version");
                fontsize = psf2h(buffer)->length;
                if (psf2h(buffer)->flags & PSF2_HAS_UNICODE_TABLE)
                        has_table = 2;
@@ -311,19 +311,19 @@ static void do_load(int fd, unsigned char *buffer, size_t len)
        } else
 #endif
        {
-               bb_error_msg_and_die("input file: bad length or unsupported font type");
+               bb_simple_error_msg_and_die("input file: bad length or unsupported font type");
        }
 
 #if !defined(PIO_FONTX) || defined(__sparc__)
        if (fontsize != 256)
-               bb_error_msg_and_die("only fontsize 256 supported");
+               bb_simple_error_msg_and_die("only fontsize 256 supported");
 #endif
 
        table = font + fontsize * charsize;
        buffer += len;
 
        if (table > buffer || (!has_table && table != buffer))
-               bb_error_msg_and_die("input file: bad length");
+               bb_simple_error_msg_and_die("input file: bad length");
 
        do_loadfont(fd, font, height, width, charsize, fontsize);
 
@@ -361,7 +361,7 @@ int loadfont_main(int argc UNUSED_PARAM, char **argv)
        buffer = xmalloc_read(STDIN_FILENO, &len);
        // xmalloc_open_zipped_read_close(filename, &len);
        if (!buffer)
-               bb_perror_msg_and_die("error reading input font");
+               bb_simple_perror_msg_and_die("error reading input font");
        do_load(get_console_fd_or_die(), buffer, len);
 
        return EXIT_SUCCESS;
@@ -502,7 +502,7 @@ int setfont_main(int argc UNUSED_PARAM, char **argv)
                                if (a < 0 || a >= E_TABSZ
                                 || b < 0 || b > 65535
                                ) {
-                                       bb_error_msg_and_die("map format");
+                                       bb_simple_error_msg_and_die("map format");
                                }
                                // patch map
                                unicodes[a] = b;
index d4981ad211307a30a1de54701cd8c3231ba6113f..91ef508844f2d5eedb40be4ab732a64d9bb0e238 100644 (file)
@@ -69,7 +69,7 @@ int loadkmap_main(int argc UNUSED_PARAM, char **argv)
 
        xread(STDIN_FILENO, flags, 7);
        if (!is_prefixed_with(flags, BINARY_KEYMAP_MAGIC))
-               bb_error_msg_and_die("not a valid binary keymap");
+               bb_simple_error_msg_and_die("not a valid binary keymap");
 
        xread(STDIN_FILENO, flags, MAX_NR_KEYMAPS);
 
index b01229a56709163dbd574e42abb797d254479dbd..9e6cffeccb5a1ce7e48fa1d1b6088ecc26c21e1d 100644 (file)
@@ -87,7 +87,7 @@ static int get_vt_fd(void)
        fd = open(DEV_CONSOLE, O_RDONLY | O_NONBLOCK);
        if (fd >= 0 && !not_vt_fd(fd))
                return fd;
-       bb_error_msg_and_die("can't find open VT");
+       bb_simple_error_msg_and_die("can't find open VT");
 }
 
 static int find_free_vtno(void)
@@ -98,7 +98,7 @@ static int find_free_vtno(void)
        errno = 0;
        /*xfunc_error_retval = 3; - do we need compat? */
        if (ioctl(fd, VT_OPENQRY, &vtno) != 0 || vtno <= 0)
-               bb_perror_msg_and_die("can't find open VT");
+               bb_simple_perror_msg_and_die("can't find open VT");
 // Not really needed, grep for DAEMON_CLOSE_EXTRA_FDS
 //     if (fd > 2)
 //             close(fd);
index c322ce99d4821524381856408cff2eacef5d63d1..8f0e9d93819184e15bf8efbc56483888f2c19b34 100644 (file)
@@ -56,7 +56,7 @@ static void xset1(struct termios *t)
 {
        int ret = tcsetattr(STDIN_FILENO, TCSAFLUSH, t);
        if (ret) {
-               bb_perror_msg("can't tcsetattr for stdin");
+               bb_simple_perror_msg("can't tcsetattr for stdin");
        }
 }
 
index 59e3d2f809f9daf2840f533a196f1becc9815ced..cfeb19fc40893911356ac44d94b7956a349e7562 100644 (file)
@@ -217,7 +217,7 @@ int cp_main(int argc, char **argv)
                //      flags, FILEUTILS_RMDEST, OPT_parents);
                if (flags & OPT_parents) {
                        if (!(d_flags & 2)) {
-                               bb_error_msg_and_die("with --parents, the destination must be a directory");
+                               bb_simple_error_msg_and_die("with --parents, the destination must be a directory");
                        }
                }
                if (flags & FILEUTILS_RMDEST) {
@@ -236,7 +236,7 @@ int cp_main(int argc, char **argv)
                        goto DO_COPY; /* NB: argc==2 -> *++argv==last */
                }
        } else if (flags & FILEUTILS_NO_TARGET_DIR) {
-               bb_error_msg_and_die("too many arguments");
+               bb_simple_error_msg_and_die("too many arguments");
        }
 
        while (1) {
index e952dc17b7c128c8a1c2734af98e0e0d19f07e27..1acbb513e65e25d585f494496025f56b7adb7eec 100644 (file)
@@ -209,11 +209,11 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
 //     argc -= optind;
        argv += optind;
        if (!(opt & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS)))
-               bb_error_msg_and_die("expected a list of bytes, characters, or fields");
+               bb_simple_error_msg_and_die("expected a list of bytes, characters, or fields");
 
        if (opt & CUT_OPT_DELIM_FLGS) {
                if (ltok[0] && ltok[1]) { /* more than 1 char? */
-                       bb_error_msg_and_die("the delimiter must be a single character");
+                       bb_simple_error_msg_and_die("the delimiter must be a single character");
                }
                delim = ltok[0];
        }
@@ -288,7 +288,7 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
 
                /* make sure we got some cut positions out of all that */
                if (nlists == 0)
-                       bb_error_msg_and_die("missing list of positions");
+                       bb_simple_error_msg_and_die("missing list of positions");
 
                /* now that the lists are parsed, we need to sort them to make life
                 * easier on us when it comes time to print the chars / fields / lines
index 3414d38aedd9f3a28e102b102ebf8fcf18c35d20..feb40043060aed02a5eee83d31214975540c1a34 100644 (file)
@@ -304,7 +304,7 @@ int date_main(int argc UNUSED_PARAM, char **argv)
 
                /* if setting time, set it */
                if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
-                       bb_perror_msg("can't set date");
+                       bb_simple_perror_msg("can't set date");
                }
        }
 
index f6d66e4b6e3ba3101aacdb9c1430089a65a57d30..debb8686751dd7ce976760bb5a22b3ef66a617b8 100644 (file)
@@ -178,7 +178,7 @@ int df_main(int argc UNUSED_PARAM, char **argv)
        if (!argv[0]) {
                mount_table = setmntent(bb_path_mtab_file, "r");
                if (!mount_table)
-                       bb_perror_msg_and_die(bb_path_mtab_file);
+                       bb_simple_perror_msg_and_die(bb_path_mtab_file);
        }
 
        while (1) {
index 5dc5be0722a90d986264d6c42334d5cc0f552a3a..b3828894c348d0baf9707c5a717008b30ffc3078 100644 (file)
@@ -188,7 +188,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv)
        /*r =*/ full_write(STDOUT_FILENO, buffer, out - buffer);
        free(buffer);
        if (/*WRONG:r < 0*/ errno) {
-               bb_perror_msg(bb_msg_write_error);
+               bb_simple_perror_msg(bb_msg_write_error);
                return 1;
        }
        return 0;
index 878068f090015f3dc4184f91767775dd54adb0b7..c37c0c2dfdd1ecc2ee8c0bf0ce7be41bbeacbbd1 100644 (file)
@@ -79,7 +79,7 @@ int env_main(int argc UNUSED_PARAM, char **argv)
 
        while (*argv && (strchr(*argv, '=') != NULL)) {
                if (putenv(*argv) < 0) {
-                       bb_perror_msg_and_die("putenv");
+                       bb_simple_perror_msg_and_die("putenv");
                }
                ++argv;
        }
index 20e4c4b2342bf4a8484f00c41bd29b6916fa44e1..4fa974df8ac9b0ebf0669c9aa5bdf271d4027277 100644 (file)
@@ -247,7 +247,7 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
        /* Now close stdin also */
        /* (if we didn't read from it, it's a no-op) */
        if (fclose(stdin))
-               bb_perror_msg_and_die(bb_msg_standard_input);
+               bb_simple_perror_msg_and_die(bb_msg_standard_input);
 
        fflush_stdout_and_exit(exit_status);
 }
index 1bdfba0042a37071abd85abfa402bf30da64ee6c..b247f08db10801fdaaad5e8e7f98f638c8e3cedc 100644 (file)
@@ -249,7 +249,7 @@ static arith_t arithmetic_common(VALUE *l, VALUE *r, int op)
        arith_t li, ri;
 
        if (!toarith(l) || !toarith(r))
-               bb_error_msg_and_die("non-numeric argument");
+               bb_simple_error_msg_and_die("non-numeric argument");
        li = l->u.i;
        ri = r->u.i;
        if (op == '+')
@@ -259,7 +259,7 @@ static arith_t arithmetic_common(VALUE *l, VALUE *r, int op)
        if (op == '*')
                return li * ri;
        if (ri == 0)
-               bb_error_msg_and_die("division by zero");
+               bb_simple_error_msg_and_die("division by zero");
        if (op == '/')
                return li / ri;
        return li % ri;
@@ -319,19 +319,19 @@ static VALUE *eval7(void)
        VALUE *v;
 
        if (!*G.args)
-               bb_error_msg_and_die("syntax error");
+               bb_simple_error_msg_and_die("syntax error");
 
        if (nextarg("(")) {
                G.args++;
                v = eval();
                if (!nextarg(")"))
-                       bb_error_msg_and_die("syntax error");
+                       bb_simple_error_msg_and_die("syntax error");
                G.args++;
                return v;
        }
 
        if (nextarg(")"))
-               bb_error_msg_and_die("syntax error");
+               bb_simple_error_msg_and_die("syntax error");
 
        return str_value(*G.args++);
 }
@@ -353,7 +353,7 @@ static VALUE *eval6(void)
        G.args++; /* We have a valid token, so get the next argument.  */
        if (key == 1) { /* quote */
                if (!*G.args)
-                       bb_error_msg_and_die("syntax error");
+                       bb_simple_error_msg_and_die("syntax error");
                return str_value(*G.args++);
        }
        if (key == 2) { /* length */
@@ -546,11 +546,11 @@ int expr_main(int argc UNUSED_PARAM, char **argv)
        xfunc_error_retval = 2; /* coreutils compat */
        G.args = argv + 1;
        if (*G.args == NULL) {
-               bb_error_msg_and_die("too few arguments");
+               bb_simple_error_msg_and_die("too few arguments");
        }
        v = eval();
        if (*G.args)
-               bb_error_msg_and_die("syntax error");
+               bb_simple_error_msg_and_die("syntax error");
        if (v->type == INTEGER)
                printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i);
        else
index 00c0cd8abd2e61c35bdb23023f7868800f54f276..f20cd7d09e0e30ab69443540a8ae57e28cdb8cf6 100644 (file)
@@ -231,7 +231,7 @@ int id_main(int argc UNUSED_PARAM, char **argv)
                        }
                } else if (n < 0) { /* error in get_groups() */
                        if (ENABLE_DESKTOP)
-                               bb_error_msg_and_die("can't get groups");
+                               bb_simple_error_msg_and_die("can't get groups");
                        return EXIT_FAILURE;
                }
                if (ENABLE_FEATURE_CLEAN_UP)
index 8270490bd47c00cc563408bcf9036d2066f63147..c0f1c538aebffd66919c5ea54e21aef65f254c47 100644 (file)
@@ -238,7 +238,7 @@ int install_main(int argc, char **argv)
                                args[2] = dest;
                                args[3] = NULL;
                                if (spawn_and_wait(args)) {
-                                       bb_perror_msg("strip");
+                                       bb_simple_perror_msg("strip");
                                        ret = EXIT_FAILURE;
                                }
                        }
index afeb0d72d88e8a6144c8ce34903203ac283aac0c..ea2d10eabe242be550076eadc159d1ab32c3310e 100644 (file)
@@ -69,7 +69,7 @@ int ln_main(int argc, char **argv)
        argc -= optind;
 
        if ((opts & LN_LINKFILE) && argc > 2) {
-               bb_error_msg_and_die("-T accepts 2 args max");
+               bb_simple_error_msg_and_die("-T accepts 2 args max");
        }
 
        if (!argv[1]) {
index 31ce61f0c2fbbb9f8fa42483bbe0a1317c98c52d..06bbe1b0eed8757bad924497f81b148ab185a9bb 100644 (file)
@@ -56,5 +56,5 @@ int logname_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
                return fflush_all();
        }
 
-       bb_perror_msg_and_die("getlogin");
+       bb_simple_perror_msg_and_die("getlogin");
 }
index 538df251beddbf214ed1a966b17cef2668ad98d2..ba26c985ac2d35e416fdf01af20f09cfab5d1aa4 100644 (file)
@@ -300,7 +300,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
                                }
                                if (filename_ptr == NULL) {
                                        if (flags & FLAG_WARN) {
-                                               bb_error_msg("invalid format");
+                                               bb_simple_error_msg("invalid format");
                                        }
                                        count_failed++;
                                        return_value = EXIT_FAILURE;
index 4cae0c5299321feeca7ef7e58b479f519b813a48..e9c071f3a5381aa7e07e12bc9e209a384c9ef879 100644 (file)
@@ -536,7 +536,7 @@ check_and_close(void)
        }
 
        if (ferror(stdout)) {
-               bb_error_msg_and_die(bb_msg_write_error);
+               bb_simple_error_msg_and_die(bb_msg_write_error);
        }
 }
 
@@ -841,7 +841,7 @@ skip(off_t n_skip)
        }
 
        if (n_skip)
-               bb_error_msg_and_die("can't skip past end of combined input");
+               bb_simple_error_msg_and_die("can't skip past end of combined input");
 }
 
 
@@ -1308,10 +1308,10 @@ int od_main(int argc UNUSED_PARAM, char **argv)
                                        pseudo_start = o2;
                                        argv[1] = NULL;
                                } else {
-                                       bb_error_msg_and_die("the last two arguments must be offsets");
+                                       bb_simple_error_msg_and_die("the last two arguments must be offsets");
                                }
                        } else { /* >3 args */
-                               bb_error_msg_and_die("too many arguments");
+                               bb_simple_error_msg_and_die("too many arguments");
                        }
 
                        if (pseudo_start >= 0) {
@@ -1332,7 +1332,7 @@ int od_main(int argc UNUSED_PARAM, char **argv)
        if (option_mask32 & OPT_N) {
                end_offset = n_bytes_to_skip + max_bytes_to_format;
                if (end_offset < n_bytes_to_skip)
-                       bb_error_msg_and_die("SKIP + SIZE is too large");
+                       bb_simple_error_msg_and_die("SKIP + SIZE is too large");
        }
 
        if (G.n_specs == 0) {
@@ -1389,7 +1389,7 @@ int od_main(int argc UNUSED_PARAM, char **argv)
                dump(n_bytes_to_skip, end_offset);
 
        if (fclose(stdin))
-               bb_perror_msg_and_die(bb_msg_standard_input);
+               bb_simple_perror_msg_and_die(bb_msg_standard_input);
 
        return G.exit_code;
 }
index 3d81a5f1ab9abfea7a7b6f1a9db9d521039d24a0..11743297ad0550d5c6bb4838d9a97149174ed957 100644 (file)
@@ -116,7 +116,7 @@ int paste_main(int argc UNUSED_PARAM, char **argv)
 
        if (opt & PASTE_OPT_DELIMITERS) {
                if (!delims[0])
-                       bb_error_msg_and_die("-d '' is not supported");
+                       bb_simple_error_msg_and_die("-d '' is not supported");
                /* unknown mappings are not changed: "\z" -> '\\' 'z' */
                /* trailing backslash, if any, is preserved */
                del_cnt = strcpy_and_process_escape_sequences(delims, delims) - delims;
index 5cf5186999474eb61515e601e31aada24fb4b008..a20fc33013b849414c8c0c95aaa2da009001972e 100644 (file)
@@ -430,7 +430,7 @@ int printf_main(int argc UNUSED_PARAM, char **argv)
                if (ENABLE_ASH_PRINTF
                 && applet_name[0] != 'p'
                ) {
-                       bb_error_msg("usage: printf FORMAT [ARGUMENT...]");
+                       bb_simple_error_msg("usage: printf FORMAT [ARGUMENT...]");
                        return 2; /* bash compat */
                }
                bb_show_usage();
index fd94bb5c49d19c6d4cdf4ef7dd01b67ab797abf2..d000129d9e702be3a8d110daeb3119e6a95e87e3 100644 (file)
@@ -62,7 +62,7 @@ int rm_main(int argc UNUSED_PARAM, char **argv)
                        const char *base = bb_get_last_path_component_strip(*argv);
 
                        if (DOT_OR_DOTDOT(base)) {
-                               bb_error_msg("can't remove '.' or '..'");
+                               bb_simple_error_msg("can't remove '.' or '..'");
                        } else if (remove_file(*argv, flags) >= 0) {
                                continue;
                        }
index f04c6067b4cd798e0a45fd36d0f41300c21a1083..07c327645923535ac526d7733ffdb9d530f80d8a 100644 (file)
@@ -277,7 +277,7 @@ static int compare_keys(const void *xarg, const void *yarg)
                /* Perform actual comparison */
                switch (flags & (FLAG_n | FLAG_g | FLAG_M | FLAG_V)) {
                default:
-                       bb_error_msg_and_die("unknown sort type");
+                       bb_simple_error_msg_and_die("unknown sort type");
                        break;
 #if defined(HAVE_STRVERSCMP) && HAVE_STRVERSCMP == 1
                case FLAG_V:
@@ -398,10 +398,10 @@ static unsigned str2u(char **str)
 {
        unsigned long lu;
        if (!isdigit((*str)[0]))
-               bb_error_msg_and_die("bad field specification");
+               bb_simple_error_msg_and_die("bad field specification");
        lu = strtoul(*str, str, 10);
        if ((sizeof(long) > sizeof(int) && lu > INT_MAX) || !lu)
-               bb_error_msg_and_die("bad field specification");
+               bb_simple_error_msg_and_die("bad field specification");
        return lu;
 }
 #endif
@@ -461,7 +461,7 @@ int sort_main(int argc UNUSED_PARAM, char **argv)
 #if ENABLE_FEATURE_SORT_BIG
        if (opts & FLAG_t) {
                if (!str_t[0] || str_t[1])
-                       bb_error_msg_and_die("bad -t parameter");
+                       bb_simple_error_msg_and_die("bad -t parameter");
                key_separator = str_t[0];
        }
        /* note: below this point we use option_mask32, not opts,
@@ -504,10 +504,10 @@ int sort_main(int argc UNUSED_PARAM, char **argv)
                                        because comma isn't in OPT_STR */
                                idx = strchr(OPT_STR, *str_k);
                                if (!idx)
-                                       bb_error_msg_and_die("unknown key option");
+                                       bb_simple_error_msg_and_die("unknown key option");
                                flag = 1 << (idx - OPT_STR);
                                if (flag & ~FLAG_allowed_for_k)
-                                       bb_error_msg_and_die("unknown sort type");
+                                       bb_simple_error_msg_and_die("unknown sort type");
                                /* b after ',' means strip _trailing_ space */
                                if (i && flag == FLAG_b)
                                        flag = FLAG_bb;
index c1e4ceab2ba9bee22e5d2a7b656b9301d407804f..ecbc9d2d82be7e3749b04410021793969acf1ad4 100644 (file)
@@ -127,7 +127,7 @@ int split_main(int argc UNUSED_PARAM, char **argv)
        }
 
        if (NAME_MAX < strlen(sfx) + suffix_len)
-               bb_error_msg_and_die("suffix too long");
+               bb_simple_error_msg_and_die("suffix too long");
 
        {
                char *char_p = xzalloc(suffix_len + 1);
@@ -147,7 +147,7 @@ int split_main(int argc UNUSED_PARAM, char **argv)
                do {
                        if (!remaining) {
                                if (!pfx)
-                                       bb_error_msg_and_die("suffixes exhausted");
+                                       bb_simple_error_msg_and_die("suffixes exhausted");
                                xmove_fd(xopen(pfx, O_WRONLY | O_CREAT | O_TRUNC), 1);
                                pfx = next_file(pfx, suffix_len);
                                remaining = cnt;
index d1309f9aabfc8cb3c3aacbfba4515fd92361f9d9..40e81279951cace9109ec05bbe927f02535141bf 100644 (file)
@@ -1320,7 +1320,7 @@ int stty_main(int argc UNUSED_PARAM, char **argv)
                                        break;
                                case 'F':
                                        if (file_name)
-                                               bb_error_msg_and_die("only one device may be specified");
+                                               bb_simple_error_msg_and_die("only one device may be specified");
                                        file_name = &arg[i+1]; /* "-Fdevice" ? */
                                        if (!file_name[0]) { /* nope, "-F device" */
                                                int p = k+1; /* argv[p] is argnext */
@@ -1405,13 +1405,13 @@ int stty_main(int argc UNUSED_PARAM, char **argv)
        if ((stty_state & (STTY_verbose_output | STTY_recoverable_output)) ==
                (STTY_verbose_output | STTY_recoverable_output)
        ) {
-               bb_error_msg_and_die("-a and -g are mutually exclusive");
+               bb_simple_error_msg_and_die("-a and -g are mutually exclusive");
        }
        /* Specifying -a or -g with non-options is an error */
        if ((stty_state & (STTY_verbose_output | STTY_recoverable_output))
         && !(stty_state & STTY_noargs)
        ) {
-               bb_error_msg_and_die("modes may not be set when -a or -g is used");
+               bb_simple_error_msg_and_die("modes may not be set when -a or -g is used");
        }
 
        /* Now it is safe to start doing things */
index 14ed85d162bd4a92d13ea9d948ced25b64f3f956..1f458f9ed1f769e013fa11bff8275b3a8914231f 100644 (file)
@@ -89,7 +89,7 @@ static ssize_t tail_read(int fd, char *buf, size_t count)
 
        r = full_read(fd, buf, count);
        if (r < 0) {
-               bb_perror_msg(bb_msg_read_error);
+               bb_simple_perror_msg(bb_msg_read_error);
                G.exitcode = EXIT_FAILURE;
        }
 
@@ -186,7 +186,7 @@ int tail_main(int argc, char **argv)
        } while (++i < argc);
 
        if (!nfiles)
-               bb_error_msg_and_die("no files");
+               bb_simple_error_msg_and_die("no files");
 
        /* prepare the buffer */
        tailbufsize = BUFSIZ;
index 8d7dac0259ca7c5b5ebfd8ba56b8817eacdccf8d..868ffbecbff1b0bb7da6287db6c21327069f1116 100644 (file)
@@ -832,12 +832,12 @@ int test_main(int argc, char **argv)
                --argc;
                if (!arg0[1]) { /* "[" ? */
                        if (NOT_LONE_CHAR(argv[argc], ']')) {
-                               bb_error_msg("missing ]");
+                               bb_simple_error_msg("missing ]");
                                return 2;
                        }
                } else { /* assuming "[[" */
                        if (strcmp(argv[argc], "]]") != 0) {
-                               bb_error_msg("missing ]]");
+                               bb_simple_error_msg("missing ]]");
                                return 2;
                        }
                }
index ae35a9ee3dbc6cf6621628b0c5f7f9e024b2cd33..1e402dfdbd4f047677b8f72ac884eb6e38110fb5 100644 (file)
@@ -308,7 +308,7 @@ int tr_main(int argc UNUSED_PARAM, char **argv)
                str1_length = complement(str1, str1_length);
        if (*argv) {
                if (argv[0][0] == '\0')
-                       bb_error_msg_and_die("STRING2 cannot be empty");
+                       bb_simple_error_msg_and_die("STRING2 cannot be empty");
                str2_length = expand(*argv, &str2);
                map(vector, str1, str1_length,
                                str2, str2_length);
@@ -333,7 +333,7 @@ int tr_main(int argc UNUSED_PARAM, char **argv)
                        read_chars = safe_read(STDIN_FILENO, str1, TR_BUFSIZ);
                        if (read_chars <= 0) {
                                if (read_chars < 0)
-                                       bb_perror_msg_and_die(bb_msg_read_error);
+                                       bb_simple_perror_msg_and_die(bb_msg_read_error);
                                break;
                        }
                        in_index = 0;
index 5f69e62b3a58e3bf6552f18928c2abb4c36cdf82..dc8ef5cca44cf3fc4cc1436453b4bf258dd27540 100644 (file)
@@ -82,7 +82,7 @@ static void FAST_FUNC read_stduu(FILE *src_stream, FILE *dst_stream, int flags U
                        continue;
                }
                if (encoded_len > 60) {
-                       bb_error_msg_and_die("line too long");
+                       bb_simple_error_msg_and_die("line too long");
                }
 
                dst = line;
@@ -108,7 +108,7 @@ static void FAST_FUNC read_stduu(FILE *src_stream, FILE *dst_stream, int flags U
                fwrite(line, 1, dst - line, dst_stream);
                free(line);
        }
-       bb_error_msg_and_die("short file");
+       bb_simple_error_msg_and_die("short file");
 }
 #endif
 
@@ -166,7 +166,7 @@ int uudecode_main(int argc UNUSED_PARAM, char **argv)
                /* fclose_if_not_stdin(src_stream); - redundant */
                return EXIT_SUCCESS;
        }
-       bb_error_msg_and_die("no 'begin' line");
+       bb_simple_error_msg_and_die("no 'begin' line");
 }
 #endif
 
@@ -216,7 +216,7 @@ int base64_main(int argc UNUSED_PARAM, char **argv)
                        if (!size)
                                break;
                        if ((ssize_t)size < 0)
-                               bb_perror_msg_and_die(bb_msg_read_error);
+                               bb_simple_perror_msg_and_die(bb_msg_read_error);
                        /* Encode the buffer we just read in */
                        bb_uuencode(dst_buf, src_buf, size, bb_uuenc_tbl_base64);
                        xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3));
index 2807ef82a22796063cdffb1ec1391a58384755ae..db49ec80a3ff9346272a730dc42035624116634e 100644 (file)
@@ -66,7 +66,7 @@ int uuencode_main(int argc UNUSED_PARAM, char **argv)
                if (!size)
                        break;
                if ((ssize_t)size < 0)
-                       bb_perror_msg_and_die(bb_msg_read_error);
+                       bb_simple_perror_msg_and_die(bb_msg_read_error);
                /* Encode the buffer we just read in */
                bb_uuencode(dst_buf, src_buf, size, tbl);
                bb_putchar('\n');
index 6fbf8b6de11b39ea30f9d9ed7a5b5ed026b1dbe5..68df44ae95795e5f7d36f624c582bd0ce01049b6 100644 (file)
@@ -317,7 +317,7 @@ static void do_procinit(void)
        }
        closedir(procdir);
        if (!pid)
-               bb_error_msg_and_die("nothing in /proc - not mounted?");
+               bb_simple_error_msg_and_die("nothing in /proc - not mounted?");
 }
 
 static int do_stop(void)
@@ -337,7 +337,7 @@ static int do_stop(void)
        } else if (userspec) {
                what = xasprintf("process(es) owned by '%s'", userspec);
        } else {
-               bb_error_msg_and_die("internal error, please report");
+               bb_simple_error_msg_and_die("internal error, please report");
        }
 
        if (!G.found_procs) {
index c93e209b54c01ded44265a03b0a8a88a998ce53a..c374690212414f3e9ef0ad2f6fc9ca518ce18253 100644 (file)
@@ -196,11 +196,11 @@ int chattr_main(int argc UNUSED_PARAM, char **argv)
 
        /* run sanity checks on all the arguments given us */
        if ((g.flags & OPT_SET) && (g.flags & (OPT_ADD|OPT_REM)))
-               bb_error_msg_and_die("= is incompatible with - and +");
+               bb_simple_error_msg_and_die("= is incompatible with - and +");
        if (g.rf & g.af)
-               bb_error_msg_and_die("can't set and unset a flag");
+               bb_simple_error_msg_and_die("can't set and unset a flag");
        if (!g.flags)
-               bb_error_msg_and_die("must use '-v', =, - or +");
+               bb_simple_error_msg_and_die("must use '-v', =, - or +");
 
        /* now run chattr on all the files passed to us */
        do change_attributes(*argv, &g); while (*++argv);
index 8a14b3bdc0a8c7e8f6583547a818084b222b779e..fc53a9043909961ef8162c5719dabc72bc43a9ac 100644 (file)
@@ -431,10 +431,10 @@ static int wait_one(int flags)
                        if (errno == EINTR)
                                continue;
                        if (errno == ECHILD) { /* paranoia */
-                               bb_error_msg("wait: no more children");
+                               bb_simple_error_msg("wait: no more children");
                                return -1;
                        }
-                       bb_perror_msg("wait");
+                       bb_simple_perror_msg("wait");
                        continue;
                }
                prev = NULL;
@@ -919,7 +919,7 @@ static void compile_fs_type(char *fs_type)
                        if (G.fs_type_negated == -1)
                                G.fs_type_negated = negate;
                        if (G.fs_type_negated != negate)
-                               bb_error_msg_and_die(
+                               bb_simple_error_msg_and_die(
 "either all or none of the filesystem types passed to -t must be prefixed "
 "with 'no' or '!'");
                }
index d25508e5d40802fea65a3ccb7302270a87b9b053..f199909018e059e61c37491a7db72cb7e3ac5fc2 100644 (file)
@@ -2633,7 +2633,7 @@ static var *evaluate(node *op, var *res)
                                        if (opn == '|') {
                                                rsm->F = popen(R.s, "w");
                                                if (rsm->F == NULL)
-                                                       bb_perror_msg_and_die("popen");
+                                                       bb_simple_perror_msg_and_die("popen");
                                                rsm->is_pipe = 1;
                                        } else {
                                                rsm->F = xfopen(R.s, opn=='w' ? "w" : "a");
@@ -3246,7 +3246,7 @@ int awk_main(int argc UNUSED_PARAM, char **argv)
        argv += optind;
        //argc -= optind;
        if (opt & OPT_W)
-               bb_error_msg("warning: option -W is ignored");
+               bb_simple_error_msg("warning: option -W is ignored");
        if (opt & OPT_F) {
                unescape_string_in_place(opt_F);
                setvar_s(intvar[FS], opt_F);
index 1462a9b18656372cd102882641a93a6666273e57..dc40ab4f135da49fa07fb9ec586207d074eaf7e1 100644 (file)
@@ -1006,7 +1006,7 @@ int diff_main(int argc UNUSED_PARAM, char **argv)
        xfunc_error_retval = 1;
 
        if (gotstdin && (S_ISDIR(stb[0].st_mode) || S_ISDIR(stb[1].st_mode)))
-               bb_error_msg_and_die("can't compare stdin to a directory");
+               bb_simple_error_msg_and_die("can't compare stdin to a directory");
 
        /* Compare metadata to check if the files are the same physical file.
         *
@@ -1037,7 +1037,7 @@ int diff_main(int argc UNUSED_PARAM, char **argv)
 #if ENABLE_FEATURE_DIFF_DIR
                diffdir(file, s_start);
 #else
-               bb_error_msg_and_die("no support for directory comparison");
+               bb_simple_error_msg_and_die("no support for directory comparison");
 #endif
        } else {
                bool dirfile = S_ISDIR(stb[0].st_mode) || S_ISDIR(stb[1].st_mode);
index 1a36add396c01c6df52a4e21fc0e6ea5cbb18ed0..d3ae8da92b3e4f1940052425685e96fb99f67471 100644 (file)
@@ -165,7 +165,7 @@ static NOINLINE int searchLines(const char *str, int num1, int num2)
 
        if (*str == '\0') {
                if (searchString[0] == '\0') {
-                       bb_error_msg("no previous search string");
+                       bb_simple_error_msg("no previous search string");
                        return 0;
                }
                str = searchString;
@@ -228,7 +228,7 @@ static const char* getNum(const char *cp, smallint *retHaveNum, int *retNum)
                        case '\'':
                                cp++;
                                if ((unsigned)(*cp - 'a') >= 26) {
-                                       bb_error_msg("bad mark name");
+                                       bb_simple_error_msg("bad mark name");
                                        return NULL;
                                }
                                haveNum = TRUE;
@@ -314,7 +314,7 @@ static int insertLine(int num, const char *data, int len)
        LINE *newLp, *lp;
 
        if ((num < 1) || (num > lastNum + 1)) {
-               bb_error_msg("inserting at bad line number");
+               bb_simple_error_msg("inserting at bad line number");
                return FALSE;
        }
 
@@ -384,7 +384,7 @@ static int readLines(const char *file, int num)
        char *cp;
 
        if ((num < 1) || (num > lastNum + 1)) {
-               bb_error_msg("bad line for read");
+               bb_simple_error_msg("bad line for read");
                return FALSE;
        }
 
@@ -629,7 +629,7 @@ static void subCommand(const char *cmd, int num1, int num2)
        cp = buf;
 
        if (isblank(*cp) || (*cp == '\0')) {
-               bb_error_msg("bad delimiter for substitute");
+               bb_simple_error_msg("bad delimiter for substitute");
                return;
        }
 
@@ -638,7 +638,7 @@ static void subCommand(const char *cmd, int num1, int num2)
 
        cp = strchr(cp, delim);
        if (cp == NULL) {
-               bb_error_msg("missing 2nd delimiter for substitute");
+               bb_simple_error_msg("missing 2nd delimiter for substitute");
                return;
        }
 
@@ -660,13 +660,13 @@ static void subCommand(const char *cmd, int num1, int num2)
                        printFlag = TRUE;
                        break;
                default:
-                       bb_error_msg("unknown option for substitute");
+                       bb_simple_error_msg("unknown option for substitute");
                        return;
        }
 
        if (*oldStr == '\0') {
                if (searchString[0] == '\0') {
-                       bb_error_msg("no previous search string");
+                       bb_simple_error_msg("no previous search string");
                        return;
                }
                oldStr = searchString;
@@ -846,7 +846,7 @@ static void doCommands(void)
 
                case 'f':
                        if (*cp != '\0' && *cp != ' ') {
-                               bb_error_msg("bad file command");
+                               bb_simple_error_msg("bad file command");
                                break;
                        }
                        cp = skip_whitespace(cp);
@@ -870,7 +870,7 @@ static void doCommands(void)
                case 'k':
                        cp = skip_whitespace(cp);
                        if ((unsigned)(*cp - 'a') >= 26 || cp[1]) {
-                               bb_error_msg("bad mark name");
+                               bb_simple_error_msg("bad mark name");
                                break;
                        }
                        marks[(unsigned)(*cp - 'a')] = num2;
@@ -887,7 +887,7 @@ static void doCommands(void)
                case 'q':
                        cp = skip_whitespace(cp);
                        if (have1 || *cp) {
-                               bb_error_msg("bad quit command");
+                               bb_simple_error_msg("bad quit command");
                                break;
                        }
                        if (!dirty)
@@ -903,12 +903,12 @@ static void doCommands(void)
 
                case 'r':
                        if (*cp != '\0' && *cp != ' ') {
-                               bb_error_msg("bad read command");
+                               bb_simple_error_msg("bad read command");
                                break;
                        }
                        cp = skip_whitespace(cp);
                        if (*cp == '\0') {
-                               bb_error_msg("no file name");
+                               bb_simple_error_msg("no file name");
                                break;
                        }
                        if (!have1)
@@ -925,14 +925,14 @@ static void doCommands(void)
 
                case 'w':
                        if (*cp != '\0' && *cp != ' ') {
-                               bb_error_msg("bad write command");
+                               bb_simple_error_msg("bad write command");
                                break;
                        }
                        cp = skip_whitespace(cp);
                        if (*cp == '\0') {
                                cp = fileName;
                                if (!cp) {
-                                       bb_error_msg("no file name specified");
+                                       bb_simple_error_msg("no file name specified");
                                        break;
                                }
                        }
@@ -960,7 +960,7 @@ static void doCommands(void)
 
                case '.':
                        if (have1) {
-                               bb_error_msg("no arguments allowed");
+                               bb_simple_error_msg("no arguments allowed");
                                break;
                        }
                        printLines(curNum, curNum, FALSE);
@@ -984,7 +984,7 @@ static void doCommands(void)
                        break;
 
                default:
-                       bb_error_msg("unimplemented command");
+                       bb_simple_error_msg("unimplemented command");
                        break;
                }
        }
index 8e09ef4888b667b307fdf30df85d5d8812f3d11b..d1f1ee2d69e0c13f59889053660ae191df39d49e 100644 (file)
@@ -30,7 +30,7 @@ static unsigned copy_lines(FILE *src_stream, FILE *dst_stream, unsigned lines_co
                        break;
                }
                if (fputs(line, dst_stream) == EOF) {
-                       bb_perror_msg_and_die("error writing to new file");
+                       bb_simple_perror_msg_and_die("error writing to new file");
                }
                free(line);
                lines_count--;
@@ -148,7 +148,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
 
                new_filename = extract_filename(patch_line, patch_level, "+++ ");
                if (!new_filename) {
-                       bb_error_msg_and_die("invalid patch");
+                       bb_simple_error_msg_and_die("invalid patch");
                }
 
                /* Get access rights from the file to be patched */
@@ -209,7 +209,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
                                /* src_beg_line will be 0 if it's a new file */
                                count = src_beg_line - src_cur_line;
                                if (copy_lines(src_stream, dst_stream, count)) {
-                                       bb_error_msg_and_die("bad src file");
+                                       bb_simple_error_msg_and_die("bad src file");
                                }
                                src_cur_line += count;
                                dst_cur_line += count;
index 3ffbf90842b9420eaecbeaac829209c69163ae87..aebab81323ac3d3e753b0754f418c1743b262b70 100644 (file)
@@ -200,7 +200,7 @@ int copy_tempfile(int fdin, char *name, char **tempname)
 
        *tempname = xasprintf("%sXXXXXX", name);
        fd = mkstemp(*tempname);
-       if(-1 == fd) bb_perror_msg_and_die("no temp file");
+       if(-1 == fd) bb_simple_perror_msg_and_die("no temp file");
 
        // Set permissions of output file
        fstat(fdin, &statbuf);
index 57d3dda161620bbbea12eb6f3d94f25d15c1659b..d3444003e58d657d39ef2e6a3afd62dc075f0269 100644 (file)
@@ -315,7 +315,7 @@ static int parse_regex_delim(const char *cmdstr, char **match, char **replace)
        /* verify that the 's' or 'y' is followed by something.  That something
         * (typically a 'slash') is now our regexp delimiter... */
        if (*cmdstr == '\0')
-               bb_error_msg_and_die("bad format in substitution expression");
+               bb_simple_error_msg_and_die("bad format in substitution expression");
        delimiter = *cmdstr_ptr++;
 
        /* save the match string */
@@ -360,7 +360,7 @@ static int get_address(const char *my_str, int *linenum, regex_t ** regex)
                } else {
                        *regex = G.previous_regex_ptr;
                        if (!G.previous_regex_ptr)
-                               bb_error_msg_and_die("no previous regexp");
+                               bb_simple_error_msg_and_die("no previous regexp");
                }
                /* Move position to next character after last delimiter */
                pos += (next+1);
@@ -378,7 +378,7 @@ static int parse_file_cmd(/*sed_cmd_t *sed_cmd,*/ const char *filecmdstr, char *
        start = skip_whitespace(filecmdstr);
        eol = strchrnul(start, '\n');
        if (eol == start)
-               bb_error_msg_and_die("empty filename");
+               bb_simple_error_msg_and_die("empty filename");
 
        if (*eol) {
                /* If lines glued together, put backslash back. */
@@ -468,7 +468,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char *substr)
                        goto out;
                default:
                        dbg("s bad flags:'%s'", substr + idx);
-                       bb_error_msg_and_die("bad option in substitution expression");
+                       bb_simple_error_msg_and_die("bad option in substitution expression");
                }
        }
  out:
@@ -688,7 +688,7 @@ static void add_cmd(const char *cmdstr)
                                idx--; /* if 0, trigger error check below */
                        }
                        if (idx < 0)
-                               bb_error_msg_and_die("no address after comma");
+                               bb_simple_error_msg_and_die("no address after comma");
                        sed_cmd->end_line_orig = sed_cmd->end_line;
                }
 
@@ -706,7 +706,7 @@ static void add_cmd(const char *cmdstr)
 
                /* last part (mandatory) will be a command */
                if (!*cmdstr)
-                       bb_error_msg_and_die("missing command");
+                       bb_simple_error_msg_and_die("missing command");
                sed_cmd->cmd = *cmdstr++;
                cmdstr = parse_cmd_args(sed_cmd, cmdstr);
 
@@ -791,7 +791,7 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p)
        if (!current_regex) {
                current_regex = G.previous_regex_ptr;
                if (!current_regex)
-                       bb_error_msg_and_die("no previous regexp");
+                       bb_simple_error_msg_and_die("no previous regexp");
        }
        G.previous_regex_ptr = current_regex;
 
@@ -962,7 +962,7 @@ static void puts_maybe_newline(char *s, FILE *file, char *last_puts_char, char l
 
        if (ferror(file)) {
                xfunc_error_retval = 4;  /* It's what gnu sed exits with... */
-               bb_error_msg_and_die(bb_msg_write_error);
+               bb_simple_error_msg_and_die(bb_msg_write_error);
        }
        *last_puts_char = lpc;
 }
@@ -1192,7 +1192,7 @@ static void process_files(void)
                                        }
                                        sed_cmd = sed_cmd->next;
                                        if (!sed_cmd)
-                                               bb_error_msg_and_die("unterminated {");
+                                               bb_simple_error_msg_and_die("unterminated {");
                                }
                        }
                        continue;
index 0ea547a75d83e7a1c087bb5f2ff184b64675db98..f8fab7028801a529fc95711ef2a00ef141a2c851 100644 (file)
@@ -1042,7 +1042,7 @@ static int readit(void) // read (maybe cursor) key from stdin
                        goto again;
                go_bottom_and_clear_to_eol();
                cookmode(); // terminal to "cooked"
-               bb_error_msg_and_die("can't read user input");
+               bb_simple_error_msg_and_die("can't read user input");
        }
        return c;
 }
index 06ad1b39c4848aee329772f32d877df163412730..d6679bd0835f4497f91b4ede9c6958bf9e9b04aa 100644 (file)
@@ -1245,7 +1245,7 @@ static action*** parse_params(char **argv)
                         * coreutils expects {} to appear only once in "-exec +"
                         */
                        if (all_subst != 1 && ap->filelist)
-                               bb_error_msg_and_die("only one '{}' allowed for -exec +");
+                               bb_simple_error_msg_and_die("only one '{}' allowed for -exec +");
 # endif
                }
 #endif
@@ -1259,7 +1259,7 @@ static action*** parse_params(char **argv)
                        endarg = argv;
                        while (1) {
                                if (!*++endarg)
-                                       bb_error_msg_and_die("unpaired '('");
+                                       bb_simple_error_msg_and_die("unpaired '('");
                                if (LONE_CHAR(*endarg, '('))
                                        nested++;
                                else if (LONE_CHAR(*endarg, ')') && !--nested) {
index 03eafd6163fc9e4c9db74f7cf0ac923959b31781..72631580323e1858a52334b7baa8415c1f1c1df4 100644 (file)
@@ -665,7 +665,7 @@ int xargs_main(int argc UNUSED_PARAM, char **argv)
        }
        /* Sanity check */
        if (n_max_chars <= 0) {
-               bb_error_msg_and_die("can't fit single argument within argument list size limit");
+               bb_simple_error_msg_and_die("can't fit single argument within argument list size limit");
        }
 
        buf = xzalloc(n_max_chars + 1);
@@ -716,7 +716,7 @@ int xargs_main(int argc UNUSED_PARAM, char **argv)
 
                if (!G.args[initial_idx]) { /* not even one ARG was added? */
                        if (*rem != '\0')
-                               bb_error_msg_and_die("argument line too long");
+                               bb_simple_error_msg_and_die("argument line too long");
                        if (opt & OPT_NO_EMPTY)
                                break;
                }
index 021100db1a2061cd2de2f400e2f17b57fef80109..111d1b790f375f1e0ce3b2aaf69bee356ddbd635 100644 (file)
@@ -1137,7 +1137,7 @@ void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC;
 ({ \
        pid_t bb__xvfork_pid = vfork(); \
        if (bb__xvfork_pid < 0) \
-               bb_perror_msg_and_die("vfork"); \
+               bb_simple_perror_msg_and_die("vfork"); \
        bb__xvfork_pid; \
 })
 #if BB_MMU
@@ -1324,13 +1324,17 @@ extern void (*die_func)(void);
 void xfunc_die(void) NORETURN FAST_FUNC;
 void bb_show_usage(void) NORETURN FAST_FUNC;
 void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
+void bb_simple_error_msg(const char *s) FAST_FUNC;
 void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
+void bb_simple_error_msg_and_die(const char *s) NORETURN FAST_FUNC;
 void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
 void bb_simple_perror_msg(const char *s) FAST_FUNC;
 void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
 void bb_simple_perror_msg_and_die(const char *s) NORETURN FAST_FUNC;
 void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
+void bb_simple_herror_msg(const char *s) FAST_FUNC;
 void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
+void bb_simple_herror_msg_and_die(const char *s) NORETURN FAST_FUNC;
 void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC;
 void bb_perror_nomsg(void) FAST_FUNC;
 void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC;
@@ -1339,12 +1343,51 @@ void bb_logenv_override(void) FAST_FUNC;
 
 #if ENABLE_FEATURE_SYSLOG_INFO
 void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
+void bb_simple_info_msg(const char *s) FAST_FUNC;
 void bb_vinfo_msg(const char *s, va_list p) FAST_FUNC;
 #else
 #define bb_info_msg bb_error_msg
+#define bb_simple_info_msg bb_simple_error_msg
 #define bb_vinfo_msg(s,p) bb_verror_msg(s,p,NULL)
 #endif
 
+#if ENABLE_WARN_SIMPLE_MSG
+/* If enabled, cause calls to bb_error_msg() et al that only take a single
+ * parameter to generate a warning.
+ */
+static inline void __attribute__ ((deprecated("use bb_simple_error_msg instead")))
+       bb_not_simple_error_msg(const char *s) { bb_simple_error_msg(s); }
+static inline void __attribute__ ((deprecated("use bb_simple_error_msg_and_die instead"))) NORETURN
+       bb_not_simple_error_msg_and_die(const char *s) { bb_simple_error_msg_and_die(s); }
+static inline void __attribute__ ((deprecated("use bb_simple_perror_msg instead")))
+       bb_not_simple_perror_msg(const char *s) { bb_simple_perror_msg(s); }
+static inline void __attribute__ ((deprecated("use bb_simple_perror_msg_and_die instead"))) NORETURN
+       bb_not_simple_perror_msg_and_die(const char *s) { bb_simple_perror_msg_and_die(s); }
+static inline void __attribute__ ((deprecated("use bb_simple_herror_msg instead")))
+       bb_not_simple_herror_msg(const char *s) { bb_simple_herror_msg(s); }
+static inline void __attribute__ ((deprecated("use bb_simple_herror_msg_and_die instead"))) NORETURN
+       bb_not_simple_herror_msg_and_die(const char *s) { bb_simple_herror_msg_and_die(s); }
+static inline void __attribute__ ((deprecated("use bb_simple_info_msg instead")))
+       bb_not_simple_info_msg(const char *s) { bb_simple_info_msg(s); }
+/* Override bb_error_msg() and related functions with macros that will
+ * substitute them for the equivalent bb_not_simple_error_msg() function when
+ * they are used with only a single parameter. Macro approach inspired by
+ * https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments and
+ * https://gustedt.wordpress.com/2010/06/03/default-arguments-for-c99
+ */
+#define _ARG18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) _17
+#define BB_MSG_KIND(...)           _ARG18(__VA_ARGS__, , , , , , , , , , , , , , , , , _not_simple)
+#define _BB_MSG(name, kind, ...)   bb##kind##name(__VA_ARGS__)
+#define BB_MSG(name, kind, ...)    _BB_MSG(name, kind, __VA_ARGS__)
+#define bb_error_msg(...)          BB_MSG(_error_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
+#define bb_error_msg_and_die(...)  BB_MSG(_error_msg_and_die, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
+#define bb_perror_msg(...)         BB_MSG(_perror_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
+#define bb_perror_msg_and_die(...) BB_MSG(_perror_msg_and_die, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
+#define bb_herror_msg(...)         BB_MSG(_herror_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
+#define bb_herror_msg_and_die(...) BB_MSG(_herror_msg_and_die, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
+#define bb_info_msg(...)           BB_MSG(_info_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
+#endif
+
 /* We need to export XXX_main from libbusybox
  * only if we build "individual" binaries
  */
index 4377d90e3473a6d2aa10ee8fa4f803cd3b2a0c3e..750f673560ef584bc8eb80fdfd7eb910d825e054 100644 (file)
@@ -208,7 +208,7 @@ static char *make_tempdir(void)
                        bb_perror_msg_and_die("can't %smount tmpfs", "un");
                }
 #else
-               bb_perror_msg_and_die("can't create temporary directory");
+               bb_simple_perror_msg_and_die("can't create temporary directory");
 #endif
        } else {
                xchdir(tempdir);
index 87086b48bc2118dceb3a434f69a844e1f03e5457..0f3c5fa4d650944e8ef342bde96a030b3a3202a7 100644 (file)
@@ -1086,7 +1086,7 @@ int init_main(int argc UNUSED_PARAM, char **argv)
                if (getpid() != 1
                 && (!ENABLE_LINUXRC || applet_name[0] != 'l') /* not linuxrc? */
                ) {
-                       bb_error_msg_and_die("must be run as PID 1");
+                       bb_simple_error_msg_and_die("must be run as PID 1");
                }
 #ifdef RB_DISABLE_CAD
                /* Turn off rebooting via CTL-ALT-DEL - we get a
index fa19e848889938a0d625b94d9a31a77168705e10..9fa17cfa1b2c2314870807760c5ab2ebb423616e 100644 (file)
@@ -631,7 +631,7 @@ static void check_suid(int applet_no)
                        /* same group / in group */
                        m >>= 3;
                if (!(m & S_IXOTH)) /* is x bit not set? */
-                       bb_error_msg_and_die("you have no permission to run this applet");
+                       bb_simple_error_msg_and_die("you have no permission to run this applet");
 
                /* We set effective AND saved ids. If saved-id is not set
                 * like we do below, seteuid(0) can still later succeed! */
@@ -643,7 +643,7 @@ static void check_suid(int applet_no)
                        rgid = sct->m_ugid.gid;
                /* else: we will set egid = rgid, thus dropping sgid effect */
                if (setresgid(-1, rgid, rgid))
-                       bb_perror_msg_and_die("setresgid");
+                       bb_simple_perror_msg_and_die("setresgid");
 
                /* Are we directed to change uid
                 * (APPLET = s** USER.GROUP or APPLET = S** USER.GROUP)?
@@ -653,7 +653,7 @@ static void check_suid(int applet_no)
                        uid = sct->m_ugid.uid;
                /* else: we will set euid = ruid, thus dropping suid effect */
                if (setresuid(-1, uid, uid))
-                       bb_perror_msg_and_die("setresuid");
+                       bb_simple_perror_msg_and_die("setresuid");
 
                goto ret;
        }
@@ -663,7 +663,7 @@ static void check_suid(int applet_no)
 
                if (!onetime) {
                        onetime = 1;
-                       bb_error_msg("using fallback suid method");
+                       bb_simple_error_msg("using fallback suid method");
                }
        }
 #   endif
@@ -673,7 +673,7 @@ static void check_suid(int applet_no)
                /* Real uid is not 0. If euid isn't 0 too, suid bit
                 * is most probably not set on our executable */
                if (geteuid())
-                       bb_error_msg_and_die("must be suid to work properly");
+                       bb_simple_error_msg_and_die("must be suid to work properly");
        } else if (APPLET_SUID(applet_no) == BB_SUID_DROP) {
                /*
                 * Drop all privileges.
index 59ae537386c20ac1e6432657927372e7823b5680..5d83c729a9c47a8b26732f5719b5c39acad4bbc7 100644 (file)
@@ -38,7 +38,7 @@ gid_t* FAST_FUNC bb_getgroups(int *ngroups, gid_t *group_array)
                        continue;
                }
                /* Some other error (should never happen on Linux) */
-               bb_perror_msg_and_die("getgroups");
+               bb_simple_perror_msg_and_die("getgroups");
        }
 
        if (ngroups)
index 5f8d980a3a9bc70d03b3b63f702e682ce888e32f..ccd909d78a493aba09316181a12cb2c020cc5bbb 100644 (file)
@@ -60,6 +60,6 @@ int unit_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
                return EXIT_FAILURE;
        }
 
-       bb_error_msg("All tests passed");
+       bb_simple_error_msg("All tests passed");
        return EXIT_SUCCESS;
 }
index d0ae78b9157c1fd747550823e4a4035618f479fa..23afd8eb9e543c6e1105ca36e71b2f6f712942ba 100644 (file)
@@ -119,7 +119,7 @@ void FAST_FUNC getcaps(void *arg)
                        caps->u32s = _LINUX_CAPABILITY_U32S_3;
                        break;
                default:
-                       bb_error_msg_and_die("unsupported capability version");
+                       bb_simple_error_msg_and_die("unsupported capability version");
        }
 
        if (capget(&caps->header, caps->data) != 0)
index 20d7c5f2dd606be26a4e3af4bf4e781e4b7991d4..9ff74123438d92ad4d05069f057d99e4533c72d7 100644 (file)
@@ -51,7 +51,7 @@ void FAST_FUNC change_identity(const struct passwd *pw)
                        return;
                }
 
-               bb_perror_msg_and_die("can't set groups");
+               bb_simple_perror_msg_and_die("can't set groups");
        }
 
        xsetgid(pw->pw_gid);
index 2d6557cd44e2a857e64e497263e900a07de7e654..49d1ec9c61d50ce62720e435643e7f3ceb1960c2 100644 (file)
@@ -327,7 +327,7 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
                ) {
                        security_context_t con;
                        if (getfscreatecon(&con) == -1) {
-                               bb_perror_msg("getfscreatecon");
+                               bb_simple_perror_msg("getfscreatecon");
                                return -1;
                        }
                        if (con) {
index dd0517cd6fde71d3b67ec42b4172252945457797..ae5c26999073e63a4aca7ec42db257738e8cf2fa 100644 (file)
@@ -87,7 +87,7 @@ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
                rd = safe_read(src_fd, buffer,
                        size > buffer_size ? buffer_size : size);
                if (rd < 0) {
-                       bb_perror_msg(bb_msg_read_error);
+                       bb_simple_perror_msg(bb_msg_read_error);
                        break;
                }
  read_ok:
@@ -100,7 +100,7 @@ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
                        ssize_t wr = full_write(dst_fd, buffer, rd);
                        if (wr < rd) {
                                if (!continue_on_write_error) {
-                                       bb_perror_msg(bb_msg_write_error);
+                                       bb_simple_perror_msg(bb_msg_write_error);
                                        break;
                                }
                                dst_fd = -1;
@@ -151,7 +151,7 @@ void FAST_FUNC bb_copyfd_exact_size(int fd1, int fd2, off_t size)
        if (sz == (size >= 0 ? size : -size))
                return;
        if (sz != -1)
-               bb_error_msg_and_die("short read");
+               bb_simple_error_msg_and_die("short read");
        /* if sz == -1, bb_copyfd_XX already complained */
        xfunc_die();
 }
index 46f1033404e500f57bfb1aa0565246c090cc8884..e5e1160c45be792cee29a1d582419ff3b7665d62 100644 (file)
@@ -57,5 +57,5 @@ void FAST_FUNC die_if_bad_username(const char *name)
         * including the terminating null byte.
         */
        if (name - start >= LOGIN_NAME_MAX)
-               bb_error_msg_and_die("name is too long");
+               bb_simple_error_msg_and_die("name is too long");
 }
index b4b49d709e77492c45fe17662a021c1ef9a65c55..8029cca0eaa0527a367ef4a4c02145d3c51b5134 100644 (file)
@@ -199,7 +199,7 @@ static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs)
                                pr->bcnt = fu->bcnt;
                                if (fu->bcnt == 0) {
                                        if (!prec)
-                                               bb_error_msg_and_die("%%s needs precision or byte count");
+                                               bb_simple_error_msg_and_die("%%s needs precision or byte count");
                                        pr->bcnt = atoi(prec);
                                }
                        } else
@@ -266,7 +266,7 @@ static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs)
 
                        /* only one conversion character if byte count */
                        if (!(pr->flags & F_ADDRESS) && fu->bcnt && nconv++) {
-                               bb_error_msg_and_die("byte count with multiple conversion characters");
+                               bb_simple_error_msg_and_die("byte count with multiple conversion characters");
                        }
                }
                /*
index 4c689c0fb442f193a221dd001589a28cdbc24186..5df74170e0aa79a4f987c353ba3b9dac33944b8e 100644 (file)
@@ -15,7 +15,7 @@ void FAST_FUNC fflush_stdout_and_exit(int retval)
 {
        xfunc_error_retval = retval;
        if (fflush(stdout))
-               bb_perror_msg_and_die(bb_msg_standard_output);
+               bb_simple_perror_msg_and_die(bb_msg_standard_output);
        /* In case we are in NOFORK applet. Do not exit() directly,
         * but use xfunc_die() */
        xfunc_die();
index 0b53524aa5f82bb84fb7d96a51bf2f143d7df589..7f2c7533230a487e39cc2571908dbf2efdf460e5 100644 (file)
@@ -62,7 +62,7 @@ int FAST_FUNC get_console_fd_or_die(void)
                }
        }
 
-       bb_error_msg_and_die("can't open console");
+       bb_simple_error_msg_and_die("can't open console");
 }
 
 /* From <linux/vt.h> */
index 241ceda9b025a9c81d065ea67f25c3a96a6753ab..087efb3c7e50f24356d018901223e081eae39e97 100644 (file)
@@ -18,7 +18,7 @@ uoff_t FAST_FUNC get_volume_size_in_bytes(int fd,
        if (override) {
                result = XATOOFF(override);
                if (result >= (uoff_t)(MAXINT(off_t)) / override_units)
-                       bb_error_msg_and_die("image size is too big");
+                       bb_simple_error_msg_and_die("image size is too big");
                result *= override_units;
                /* seek past end fails on block devices but works on files */
                if (lseek(fd, result - 1, SEEK_SET) != (off_t)-1) {
@@ -42,7 +42,7 @@ uoff_t FAST_FUNC get_volume_size_in_bytes(int fd,
         *
         * Picked 16k arbitrarily: */
        if (result < 16*1024)
-               bb_error_msg_and_die("image is too small");
+               bb_simple_error_msg_and_die("image is too small");
 
        return result;
 }
index 5d24ca9307e3133db29a22d2abc08182d1dc080f..9ec6265ad3648b7e1c920e1a36ba1e2cf4619ccf 100644 (file)
@@ -23,14 +23,14 @@ int FAST_FUNC xgetpty(char *line)
                        const char *name;
                        name = ptsname(p); /* find out the name of slave pty */
                        if (!name) {
-                               bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
+                               bb_simple_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
                        }
                        safe_strncpy(line, name, GETPTY_BUFSIZE);
                }
 # else
                /* find out the name of slave pty */
                if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) {
-                       bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
+                       bb_simple_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
                }
                line[GETPTY_BUFSIZE-1] = '\0';
 # endif
@@ -61,5 +61,5 @@ int FAST_FUNC xgetpty(char *line)
                }
        }
 #endif /* FEATURE_DEVPTS */
-       bb_error_msg_and_die("can't find free pty");
+       bb_simple_error_msg_and_die("can't find free pty");
 }
index d041076e00001385bb04cc06a1a1693812faf9b7..a7dd986790a4972172ae5403e7709b2bf874dc84 100644 (file)
@@ -26,3 +26,13 @@ void FAST_FUNC bb_herror_msg_and_die(const char *s, ...)
        va_end(p);
        xfunc_die();
 }
+
+void FAST_FUNC bb_simple_herror_msg(const char *s)
+{
+       bb_herror_msg("%s", s);
+}
+
+void FAST_FUNC bb_simple_herror_msg_and_die(const char *s)
+{
+       bb_herror_msg_and_die("%s", s);
+}
index 131705ddbf1c01908e90027cb15486f31b37725c..aa1a2a103b05d1b46e62a817bd117c203e5e6820 100644 (file)
@@ -21,7 +21,7 @@ void FAST_FUNC erase_mtab(const char *name)
        /* Bummer. Fall back on trying the /proc filesystem */
        if (!mountTable) mountTable = setmntent("/proc/mounts", "r");
        if (!mountTable) {
-               bb_perror_msg(bb_path_mtab_file);
+               bb_simple_perror_msg(bb_path_mtab_file);
                return;
        }
 
@@ -49,6 +49,6 @@ void FAST_FUNC erase_mtab(const char *name)
                }
                endmntent(mountTable);
        } else if (errno != EROFS)
-               bb_perror_msg(bb_path_mtab_file);
+               bb_simple_perror_msg(bb_path_mtab_file);
 }
 #endif
index a2a11cc8eda3a9c9c811272b09f57694d2002fbb..d7d53de4459d8f70a3f7c197f3be91e2ffc561ef 100644 (file)
  * instead of including libbb.h */
 //#include "libbb.h"
 #include "platform.h"
-extern void bb_perror_msg(const char *s, ...) FAST_FUNC;
+extern void bb_simple_perror_msg(const char *s) FAST_FUNC;
 
 /* suppress gcc "no previous prototype" warning */
 void FAST_FUNC bb_perror_nomsg(void);
 void FAST_FUNC bb_perror_nomsg(void)
 {
-       bb_perror_msg(0);
+       bb_simple_perror_msg(0);
 }
index 543ff51784a3574769611b8dce4be241547025e0..bea5f25a52b30fac10dad0025a14cc003f780b5c 100644 (file)
  * instead of including libbb.h */
 //#include "libbb.h"
 #include "platform.h"
-extern void bb_perror_msg_and_die(const char *s, ...) FAST_FUNC;
+extern void bb_simple_perror_msg_and_die(const char *s) FAST_FUNC;
 
 /* suppress gcc "no previous prototype" warning */
 void FAST_FUNC bb_perror_nomsg_and_die(void);
 void FAST_FUNC bb_perror_nomsg_and_die(void)
 {
-       bb_perror_msg_and_die(0);
+       bb_simple_perror_msg_and_die(0);
 }
index cb582c0807abeeb2a826957b8ad328aafae3f94a..0cd04ab7b66511d47781e97efe7a00458666b5ca 100644 (file)
@@ -217,7 +217,7 @@ void FAST_FUNC xread(int fd, void *buf, size_t count)
        if (count) {
                ssize_t size = full_read(fd, buf, count);
                if ((size_t)size != count)
-                       bb_error_msg_and_die("short read");
+                       bb_simple_error_msg_and_die("short read");
        }
 }
 
index cf93a97740fed597a246b9e3b1251929667ba77d..a07e785f31b84cede187d6c3ca93d762296354b6 100644 (file)
@@ -27,7 +27,7 @@ int FAST_FUNC safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout)
                /* I doubt many callers would handle this correctly! */
                if (errno == ENOMEM)
                        continue;
-               bb_perror_msg("poll");
+               bb_simple_perror_msg("poll");
                return n;
        }
 }
index c2585557f200a3505b5bfcbb91df09a5c822fe1b..f917a1c6a10e1788c40c227b4cff2372dc2d73fd 100644 (file)
@@ -48,7 +48,7 @@ void FAST_FUNC selinux_preserve_fcontext(int fdesc)
        if (fgetfilecon(fdesc, &context) < 0) {
                if (errno == ENODATA || errno == ENOTSUP)
                        return;
-               bb_perror_msg_and_die("fgetfilecon failed");
+               bb_simple_perror_msg_and_die("fgetfilecon failed");
        }
        setfscreatecon_or_die(context);
        freecon(context);
index f9b8da0b3648730d031afce6545ddbbc7dce48ac..cab0ad602137c2cf72beda485ea6b593e0aedae4 100644 (file)
@@ -258,7 +258,7 @@ char* FAST_FUNC strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp)
 static void get_mono(struct timespec *ts)
 {
        if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, ts))
-               bb_error_msg_and_die("clock_gettime(MONOTONIC) failed");
+               bb_simple_error_msg_and_die("clock_gettime(MONOTONIC) failed");
 }
 unsigned long long FAST_FUNC monotonic_ns(void)
 {
index dc967683ade111026226a9487ea63c2f51ee71d3..c605c4c6465f0bab67bc430994a6659b0b33bab4 100644 (file)
@@ -25,7 +25,7 @@ static void check_selinux_update_passwd(const char *username)
                return;  /* No need to check */
 
        if (getprevcon_raw(&context) < 0)
-               bb_perror_msg_and_die("getprevcon failed");
+               bb_simple_perror_msg_and_die("getprevcon failed");
        seuser = strtok(context, ":");
        if (!seuser)
                bb_error_msg_and_die("invalid context '%s'", context);
@@ -42,7 +42,7 @@ static void check_selinux_update_passwd(const char *username)
 
                if (selinux_check_passwd_access(av) != 0)
  die:
-                       bb_error_msg_and_die("SELinux: access denied");
+                       bb_simple_error_msg_and_die("SELinux: access denied");
        }
        if (ENABLE_FEATURE_CLEAN_UP)
                freecon(context);
index f32a3da7d848014a6640784f6441a9c814849640..d36b34f636742e24a0bb961b3f76a5c271f360de 100644 (file)
@@ -213,7 +213,7 @@ void FAST_FUNC read_base64(FILE *src_stream, FILE *dst_stream, int flags)
                        if (*in_tail == '\0')
                                return;
                        /* No */
-                       bb_error_msg_and_die("truncated base64 input");
+                       bb_simple_error_msg_and_die("truncated base64 input");
                }
 
                /* It was partial decode */
index 6d34599054fbef08c33417516bd105a8b96f5847..71512aee2c9751520e9aa99fbca77bc2ae49f339 100644 (file)
@@ -197,4 +197,19 @@ void FAST_FUNC bb_info_msg(const char *s, ...)
        bb_vinfo_msg(s, p);
        va_end(p);
 }
+
+void FAST_FUNC bb_simple_info_msg(const char *s)
+{
+       bb_info_msg("%s", s);
+}
 #endif
+
+void FAST_FUNC bb_simple_error_msg(const char *s)
+{
+       bb_error_msg("%s", s);
+}
+
+void FAST_FUNC bb_simple_error_msg_and_die(const char *s)
+{
+       bb_error_msg_and_die("%s", s);
+}
index 3f3025c03768cec211746e5ed104154dbaa10587..b24546e413065184616059c9c4de5cec924350a4 100644 (file)
@@ -12,7 +12,7 @@
 void FAST_FUNC bb_warn_ignoring_args(char *arg)
 {
        if (arg) {
-               bb_error_msg("ignoring all arguments");
+               bb_simple_error_msg("ignoring all arguments");
        }
 }
 #endif
index eb2871cb10c6ff8b7c9ec109a72215e67b5c4ff3..e9a2470e4173c7df8fecfc8b077004e7733b2fab 100644 (file)
@@ -66,7 +66,7 @@ int FAST_FUNC setsockopt_bindtodevice(int fd, const char *iface)
 int FAST_FUNC setsockopt_bindtodevice(int fd UNUSED_PARAM,
                const char *iface UNUSED_PARAM)
 {
-       bb_error_msg("SO_BINDTODEVICE is not supported on this system");
+       bb_simple_error_msg("SO_BINDTODEVICE is not supported on this system");
        return -1;
 }
 #endif
@@ -109,7 +109,7 @@ void FAST_FUNC xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen)
                        bb_perror_msg_and_die("%s (%s)",
                                "can't connect to remote host",
                                inet_ntoa(((struct sockaddr_in *)s_addr)->sin_addr));
-               bb_perror_msg_and_die("can't connect to remote host");
+               bb_simple_perror_msg_and_die("can't connect to remote host");
        }
 }
 
index b4d512bd67063c0885ef278bcb92550162b70638..ee2dbdef19e45fc6fef88449033a5742fa249274 100644 (file)
@@ -426,6 +426,6 @@ int FAST_FUNC wait_for_exitstatus(pid_t pid)
 
        n = safe_waitpid(pid, &exit_status, 0);
        if (n < 0)
-               bb_perror_msg_and_die("waitpid");
+               bb_simple_perror_msg_and_die("waitpid");
        return exit_status;
 }
index 6cc60f6c088ee6c79dcb2c90e669a2a32f8bbfba..93f325c6236a4f703a34b736f453f503320fc5f1 100644 (file)
@@ -27,7 +27,7 @@
 
 void FAST_FUNC bb_die_memory_exhausted(void)
 {
-       bb_error_msg_and_die(bb_msg_memory_exhausted);
+       bb_simple_error_msg_and_die(bb_msg_memory_exhausted);
 }
 
 #ifndef DMALLOC
@@ -40,7 +40,7 @@ void* FAST_FUNC malloc_or_warn(size_t size)
 {
        void *ptr = malloc(size);
        if (ptr == NULL && size != 0)
-               bb_error_msg(bb_msg_memory_exhausted);
+               bb_simple_error_msg(bb_msg_memory_exhausted);
        return ptr;
 }
 
@@ -97,7 +97,7 @@ char* FAST_FUNC xstrndup(const char *s, int n)
        char *t;
 
        if (ENABLE_DEBUG && s == NULL)
-               bb_error_msg_and_die("xstrndup bug");
+               bb_simple_error_msg_and_die("xstrndup bug");
 
        /* We can just xmalloc(n+1) and strncpy into it, */
        /* but think about xstrndup("abc", 10000) wastage! */
@@ -215,13 +215,13 @@ int FAST_FUNC rename_or_warn(const char *oldpath, const char *newpath)
 void FAST_FUNC xpipe(int filedes[2])
 {
        if (pipe(filedes))
-               bb_perror_msg_and_die("can't create pipe");
+               bb_simple_perror_msg_and_die("can't create pipe");
 }
 
 void FAST_FUNC xdup2(int from, int to)
 {
        if (dup2(from, to) != to)
-               bb_perror_msg_and_die("can't duplicate file descriptor");
+               bb_simple_perror_msg_and_die("can't duplicate file descriptor");
                //              " %d to %d", from, to);
 }
 
@@ -245,7 +245,7 @@ void FAST_FUNC xwrite(int fd, const void *buf, size_t count)
                         * or some writes succeeded, then we hit an error.
                         * In either case, errno is set.
                         */
-                       bb_perror_msg_and_die(
+                       bb_simple_perror_msg_and_die(
                                size >= 0 ? "short write" : "write error"
                        );
                }
@@ -259,7 +259,7 @@ void FAST_FUNC xwrite_str(int fd, const char *str)
 void FAST_FUNC xclose(int fd)
 {
        if (close(fd))
-               bb_perror_msg_and_die("close failed");
+               bb_simple_perror_msg_and_die("close failed");
 }
 
 // Die with an error message if we can't lseek to the right spot.
@@ -267,9 +267,7 @@ off_t FAST_FUNC xlseek(int fd, off_t offset, int whence)
 {
        off_t off = lseek(fd, offset, whence);
        if (off == (off_t)-1) {
-               if (whence == SEEK_SET)
-                       bb_perror_msg_and_die("lseek(%"OFF_FMT"u)", offset);
-               bb_perror_msg_and_die("lseek");
+               bb_perror_msg_and_die("lseek(%"OFF_FMT"u, %d)", offset, whence);
        }
        return off;
 }
@@ -384,23 +382,23 @@ void FAST_FUNC bb_unsetenv_and_free(char *var)
 // setgid() will fail and we'll _still_be_root_, which is bad.)
 void FAST_FUNC xsetgid(gid_t gid)
 {
-       if (setgid(gid)) bb_perror_msg_and_die("setgid");
+       if (setgid(gid)) bb_simple_perror_msg_and_die("setgid");
 }
 
 // Die with an error message if we can't set uid.  (See xsetgid() for why.)
 void FAST_FUNC xsetuid(uid_t uid)
 {
-       if (setuid(uid)) bb_perror_msg_and_die("setuid");
+       if (setuid(uid)) bb_simple_perror_msg_and_die("setuid");
 }
 
 void FAST_FUNC xsetegid(gid_t egid)
 {
-       if (setegid(egid)) bb_perror_msg_and_die("setegid");
+       if (setegid(egid)) bb_simple_perror_msg_and_die("setegid");
 }
 
 void FAST_FUNC xseteuid(uid_t euid)
 {
-       if (seteuid(euid)) bb_perror_msg_and_die("seteuid");
+       if (seteuid(euid)) bb_simple_perror_msg_and_die("seteuid");
 }
 
 // Die if we can't chdir to a new path.
@@ -413,7 +411,7 @@ void FAST_FUNC xchdir(const char *path)
 void FAST_FUNC xfchdir(int fd)
 {
        if (fchdir(fd))
-               bb_perror_msg_and_die("fchdir");
+               bb_simple_perror_msg_and_die("fchdir");
 }
 
 void FAST_FUNC xchroot(const char *path)
@@ -463,7 +461,7 @@ int FAST_FUNC xsocket(int domain, int type, int protocol)
 IF_FEATURE_IPV6(if (domain == AF_INET6) s = "INET6";)
                bb_perror_msg_and_die("socket(AF_%s,%d,%d)", s, type, protocol);
 #else
-               bb_perror_msg_and_die("socket");
+               bb_simple_perror_msg_and_die("socket");
 #endif
        }
 
@@ -473,13 +471,13 @@ IF_FEATURE_IPV6(if (domain == AF_INET6) s = "INET6";)
 // Die with an error message if we can't bind a socket to an address.
 void FAST_FUNC xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen)
 {
-       if (bind(sockfd, my_addr, addrlen)) bb_perror_msg_and_die("bind");
+       if (bind(sockfd, my_addr, addrlen)) bb_simple_perror_msg_and_die("bind");
 }
 
 // Die with an error message if we can't listen for connections on a socket.
 void FAST_FUNC xlisten(int s, int backlog)
 {
-       if (listen(s, backlog)) bb_perror_msg_and_die("listen");
+       if (listen(s, backlog)) bb_simple_perror_msg_and_die("listen");
 }
 
 /* Die with an error message if sendto failed.
@@ -491,7 +489,7 @@ ssize_t FAST_FUNC xsendto(int s, const void *buf, size_t len, const struct socka
        if (ret < 0) {
                if (ENABLE_FEATURE_CLEAN_UP)
                        close(s);
-               bb_perror_msg_and_die("sendto");
+               bb_simple_perror_msg_and_die("sendto");
        }
        return ret;
 }
@@ -519,12 +517,12 @@ void FAST_FUNC selinux_or_die(void)
 #if ENABLE_SELINUX
        int rc = is_selinux_enabled();
        if (rc == 0) {
-               bb_error_msg_and_die("SELinux is disabled");
+               bb_simple_error_msg_and_die("SELinux is disabled");
        } else if (rc < 0) {
-               bb_error_msg_and_die("is_selinux_enabled() failed");
+               bb_simple_error_msg_and_die("is_selinux_enabled() failed");
        }
 #else
-       bb_error_msg_and_die("SELinux support is disabled");
+       bb_simple_error_msg_and_die("SELinux support is disabled");
 #endif
 }
 
@@ -675,7 +673,7 @@ pid_t FAST_FUNC xfork(void)
        pid_t pid;
        pid = fork();
        if (pid < 0) /* wtf? */
-               bb_perror_msg_and_die("vfork"+1);
+               bb_simple_perror_msg_and_die("vfork"+1);
        return pid;
 }
 #endif
index 7f9088bdae830b679b3d0ada243488d24f4d1f57..f4e76898234f4edd1afe558eef9042eb69153df2 100644 (file)
@@ -33,7 +33,7 @@ xrealloc_getcwd_or_warn(char *cwd)
                        if (errno == ERANGE)
                                continue;
                        free(cwd);
-                       bb_perror_msg("getcwd");
+                       bb_simple_perror_msg("getcwd");
                        return NULL;
                }
                cwd = xrealloc(cwd, strlen(cwd) + 1);
index 89d0329cc4fbe4f333c8bc15eb91e005fa74c484..9446daba7de857a278e50aa30849040a1a443493 100644 (file)
@@ -12,6 +12,6 @@ struct hostent* FAST_FUNC xgethostbyname(const char *name)
 {
        struct hostent *retval = gethostbyname(name);
        if (!retval)
-               bb_herror_msg_and_die("%s", name);
+               bb_simple_herror_msg_and_die(name);
        return retval;
 }
index baa961ff350aaa68ccf8c41e3bb424e1bc2a730f..2a83c8a1574cc93275c4730aff7eab36713d3bf8 100644 (file)
@@ -149,7 +149,7 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv)
 
        /* need to be root */
        if (geteuid()) {
-               bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
+               bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
        }
        /* Syntax:
         *  addgroup group
index 850c810c493ad871f536ebe4d2a4279fb0d85c6a..d3c795afa48bec5306c475b510c9cd02680ed4e2 100644 (file)
@@ -159,7 +159,7 @@ static void passwd_wrapper(const char *login_name) NORETURN;
 static void passwd_wrapper(const char *login_name)
 {
        BB_EXECLP("passwd", "passwd", "--", login_name, NULL);
-       bb_error_msg_and_die("can't execute passwd, you must set password manually");
+       bb_simple_error_msg_and_die("can't execute passwd, you must set password manually");
 }
 
 //FIXME: upstream adduser has no short options! NOT COMPATIBLE!
@@ -193,7 +193,7 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
 
        /* got root? */
        if (geteuid()) {
-               bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
+               bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
        }
 
        pw.pw_gecos = (char *)"Linux User,,,";
index dd0532c6640cc0cc6b378d578f6588bc4fc52cb5..4e70b25570863cb6e4be07c98d905a2da6cb5af2 100644 (file)
@@ -63,7 +63,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv)
        int opt;
 
        if (getuid() != 0)
-               bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
+               bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
 
        opt = getopt32long(argv, "^" "emc:R:" "\0" "m--ec:e--mc:c--em",
                        chpasswd_longopts,
@@ -81,7 +81,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv)
 
                pass = strchr(name, ':');
                if (!pass)
-                       bb_error_msg_and_die("missing new password");
+                       bb_simple_error_msg_and_die("missing new password");
                *pass++ = '\0';
 
                xuname2uid(name); /* dies if there is no such user */
index d7e9327baaf665711402ef78bec0d5d0557c6429..56bc7eaa621e9f868d8adbac027c93f3dce01852 100644 (file)
@@ -76,7 +76,7 @@ int deluser_main(int argc, char **argv)
 #endif
 
        if (geteuid() != 0)
-               bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
+               bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
 
        name = argv[1];
        member = NULL;
index 23e92bc77da0bc540068537bb9cb46f703a1bc6e..7393a3d1c5ad956f17d261dd3e2112904b4d3197 100644 (file)
@@ -168,7 +168,7 @@ static void parse_speeds(char *arg)
                /* note: arg "0" turns into speed B0 */
                G.numspeed++;
                if (G.numspeed > MAX_SPEED)
-                       bb_error_msg_and_die("too many alternate speeds");
+                       bb_simple_error_msg_and_die("too many alternate speeds");
        }
        debug("exiting parse_speeds\n");
 }
@@ -230,7 +230,7 @@ static void open_tty(void)
                 * Make sure it is open for read/write.
                 */
                if ((fcntl(0, F_GETFL) & (O_RDWR|O_RDONLY|O_WRONLY)) != O_RDWR)
-                       bb_error_msg_and_die("stdin is not open for read/write");
+                       bb_simple_error_msg_and_die("stdin is not open for read/write");
 
                /* Try to get real tty name instead of "-" */
                n = xmalloc_ttyname(0);
@@ -243,7 +243,7 @@ static void open_tty(void)
 static void set_tty_attrs(void)
 {
        if (tcsetattr_stdin_TCSANOW(&G.tty_attrs) < 0)
-               bb_perror_msg_and_die("tcsetattr");
+               bb_simple_perror_msg_and_die("tcsetattr");
 }
 
 /* We manipulate tty_attrs this way:
@@ -485,7 +485,7 @@ static char *get_logname(void)
                                finalize_tty_attrs();
                                if (errno == EINTR || errno == EIO)
                                        exit(EXIT_SUCCESS);
-                               bb_perror_msg_and_die(bb_msg_read_error);
+                               bb_simple_perror_msg_and_die(bb_msg_read_error);
                        }
 
                        switch (c) {
@@ -582,7 +582,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
                        //      " sid %d pgid %d",
                        //      pid, getppid(),
                        //      getsid(0), getpgid(0));
-                       bb_perror_msg_and_die("setsid");
+                       bb_simple_perror_msg_and_die("setsid");
                        /*
                         * When we can end up here?
                         * Example: setsid() fails when run alone in interactive shell:
@@ -651,13 +651,13 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
        tsid = tcgetsid(STDIN_FILENO);
        if (tsid < 0 || pid != tsid) {
                if (ioctl(STDIN_FILENO, TIOCSCTTY, /*force:*/ (long)1) < 0)
-                       bb_perror_msg_and_die("TIOCSCTTY");
+                       bb_simple_perror_msg_and_die("TIOCSCTTY");
        }
 
 #ifdef __linux__
        /* Make ourself a foreground process group within our session */
        if (tcsetpgrp(STDIN_FILENO, pid) < 0)
-               bb_perror_msg_and_die("tcsetpgrp");
+               bb_simple_perror_msg_and_die("tcsetpgrp");
 #endif
 
        /*
@@ -669,7 +669,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
         * 5 seconds seems to be a good value.
         */
        if (tcgetattr(STDIN_FILENO, &G.tty_attrs) < 0)
-               bb_perror_msg_and_die("tcgetattr");
+               bb_simple_perror_msg_and_die("tcgetattr");
 
        /* Update the utmp file. This tty is ours now! */
        update_utmp(pid, LOGIN_PROCESS, G.tty_name, "LOGIN", G.fakehost);
index a08642a34d678aa3be9bf97d200b089537723854..4e65b3a19c789dec8a41778dfd49a0410a797b03 100644 (file)
@@ -358,7 +358,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
        opt = getopt32(argv, "f:h:p", &opt_user, &opt_host);
        if (opt & LOGIN_OPT_f) {
                if (!run_by_root)
-                       bb_error_msg_and_die("-f is for root only");
+                       bb_simple_error_msg_and_die("-f is for root only");
                safe_strncpy(username, opt_user, sizeof(username));
        }
        argv += optind;
@@ -529,7 +529,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
        child_pid = vfork();
        if (child_pid != 0) {
                if (child_pid < 0)
-                       bb_perror_msg("vfork");
+                       bb_simple_perror_msg("vfork");
                else {
                        wait_for_exitstatus(child_pid);
                        update_utmp_DEAD_PROCESS(child_pid);
index 41291ea8f5b08bb2d58b043d9bc7dc4dd2683e62..7c1fc69c5b6a7443e601967ce19f8ab831e7ca90 100644 (file)
@@ -147,7 +147,7 @@ int su_main(int argc UNUSED_PARAM, char **argv)
                        syslog(LOG_NOTICE, "%c %s %s:%s",
                                '-', tty, old_user, opt_username);
                bb_do_delay(LOGIN_FAIL_DELAY);
-               bb_error_msg_and_die("incorrect password");
+               bb_simple_error_msg_and_die("incorrect password");
        }
 
        if (ENABLE_FEATURE_CLEAN_UP && ENABLE_FEATURE_SU_SYSLOG) {
@@ -165,7 +165,7 @@ int su_main(int argc UNUSED_PARAM, char **argv)
                 * probably a uucp account or has restricted access.  Don't
                 * compromise the account by allowing access with a standard
                 * shell.  */
-               bb_error_msg("using restricted shell");
+               bb_simple_error_msg("using restricted shell");
                opt_shell = NULL; /* ignore -s PROG */
        }
        /* else: user can run whatever he wants via "su -s PROG USER".
index 9bb4d3613bc622c4a7d3952a30f8b1c2507ee9f7..099085340794f0ab16523c590205be1c10ae047d 100644 (file)
@@ -56,7 +56,7 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
 
        pwd = getpwuid(0);
        if (!pwd) {
-               bb_error_msg_and_die("no password entry for root");
+               bb_simple_error_msg_and_die("no password entry for root");
        }
 
        while (1) {
@@ -68,17 +68,17 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
                );
                if (r < 0) {
                        /* ^D, ^C, timeout, or read error */
-                       bb_info_msg("normal startup");
+                       bb_simple_info_msg("normal startup");
                        return 0;
                }
                if (r > 0) {
                        break;
                }
                bb_do_delay(LOGIN_FAIL_DELAY);
-               bb_info_msg("Login incorrect");
+               bb_simple_info_msg("Login incorrect");
        }
 
-       bb_info_msg("starting shell for system maintenance");
+       bb_simple_info_msg("starting shell for system maintenance");
 
        IF_SELINUX(renew_current_security_context());
 
index 6726654f78d261ee06f76591be45d8f6b7d081ba..3a1fd69496386836087270d7c559fa2950d72a19 100644 (file)
@@ -15,7 +15,7 @@ static void signal_handler(int signo)
 {
 #define err signo
        if (SIGALRM == signo) {
-               bb_error_msg_and_die("timed out");
+               bb_simple_error_msg_and_die("timed out");
        }
 
        // SIGCHLD. reap zombies
@@ -128,7 +128,7 @@ static void encode_n_base64(const char *fname, const char *text, size_t len)
                if (fname) {
                        size = fread((char *)src_buf, 1, SRC_BUF_SIZE, fp);
                        if ((ssize_t)size < 0)
-                               bb_perror_msg_and_die(bb_msg_read_error);
+                               bb_simple_perror_msg_and_die(bb_msg_read_error);
                } else {
                        size = len;
                        if (len > SRC_BUF_SIZE)
@@ -179,5 +179,5 @@ void FAST_FUNC get_cred_or_die(int fd)
                G.pass = xmalloc_reads(fd, /* maxsize: */ NULL);
        }
        if (!G.user || !*G.user || !G.pass)
-               bb_error_msg_and_die("no username or password");
+               bb_simple_error_msg_and_die("no username or password");
 }
index 589456715420d372f837c203491f51b68ce8c9d6..6927e3a58e374a7df376c1ad1fbaff7537e6b66a 100644 (file)
@@ -222,7 +222,7 @@ int popmaildir_main(int argc UNUSED_PARAM, char **argv)
                        fp = popen(delivery, "w");
                        unsetenv("FILENAME");
                        if (!fp) {
-                               bb_perror_msg("delivery helper");
+                               bb_simple_perror_msg("delivery helper");
                                break;
                        }
                } else
index 32c50ba840198cfda356485411f343edf2ea99d8..1bdc1c30008169f46bd9a9935292362471280c00 100644 (file)
@@ -338,7 +338,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
                        smtp_check(NULL, 250);
                else
                if (code != 250)
-                       bb_error_msg_and_die("SMTP init failed");
+                       bb_simple_error_msg_and_die("SMTP init failed");
        } else {
                // vanilla connection
                int fd;
index aba51e5f8993262abf7eea3205d4bcb9d2fa0cb8..7ac30dd532fb109aea2221e67099898954649917 100644 (file)
@@ -893,7 +893,7 @@ static void fflush_and_check(void)
 {
        fflush_all();
        if (ferror(stdout) || ferror(stderr))
-               bb_perror_msg_and_die("output error");
+               bb_simple_perror_msg_and_die("output error");
 }
 
 #if ENABLE_FEATURE_CLEAN_UP
@@ -908,7 +908,7 @@ static void quit(void) NORETURN;
 static void quit(void)
 {
        if (ferror(stdin))
-               bb_perror_msg_and_die("input error");
+               bb_simple_perror_msg_and_die("input error");
        fflush_and_check();
        dbg_exec("quit(): exiting with exitcode SUCCESS");
        exit(0);
@@ -2576,7 +2576,7 @@ static void xc_read_line(BcVec *vec, FILE *fp)
                                goto get_char;
                        if (c == EOF) {
                                if (ferror(fp))
-                                       bb_perror_msg_and_die("input error");
+                                       bb_simple_perror_msg_and_die("input error");
                                // Note: EOF does not append '\n'
                                break;
                        }
@@ -6925,9 +6925,9 @@ static BC_STATUS zxc_vm_process(const char *text)
                ip = (void*)G.prog.exestack.v;
 #if SANITY_CHECKS
                if (G.prog.exestack.len != 1) // should have only main's IP
-                       bb_error_msg_and_die("BUG:call stack");
+                       bb_simple_error_msg_and_die("BUG:call stack");
                if (ip->func != BC_PROG_MAIN)
-                       bb_error_msg_and_die("BUG:not MAIN");
+                       bb_simple_error_msg_and_die("BUG:not MAIN");
 #endif
                f = xc_program_func_BC_PROG_MAIN();
                // bc discards strings, constants and code after each
@@ -6943,7 +6943,7 @@ static BC_STATUS zxc_vm_process(const char *text)
                if (IS_BC) {
 #if SANITY_CHECKS
                        if (G.prog.results.len != 0) // should be empty
-                               bb_error_msg_and_die("BUG:data stack");
+                               bb_simple_error_msg_and_die("BUG:data stack");
 #endif
                        IF_BC(bc_vec_pop_all(&f->strs);)
                        IF_BC(bc_vec_pop_all(&f->consts);)
index 5183d1369e58eb027815f0769635214c9d41efe4..a04565063d207552d5c6376ea0d60553df2cd72f 100644 (file)
@@ -307,7 +307,7 @@ int chat_main(int argc UNUSED_PARAM, char **argv)
                        } else if (DIR_SAY == key) {
                                // just print argument verbatim
                                // TODO: should we use full_write() to avoid unistd/stdio conflict?
-                               bb_error_msg("%s", arg);
+                               bb_simple_error_msg(arg);
                        }
                        // next, please!
                        argv++;
index b533a39912dca989ef90c8629122715cefece185..2e8ca8b680580e48812667c75b12af1bb482f28d 100644 (file)
@@ -731,7 +731,7 @@ fork_job(const char *user, int mailFd, CronLine *line, bool run_sendmail)
        logmode = sv_logmode;
 
        if (pid < 0) {
-               bb_perror_msg("vfork");
+               bb_simple_perror_msg("vfork");
  err:
                pid = 0;
        } /* else: PARENT, FORK SUCCESS */
@@ -861,7 +861,7 @@ static pid_t start_one_job(const char *user, CronLine *line)
                bb_error_msg_and_die("can't execute '%s' for user %s", shell, user);
        }
        if (pid < 0) {
-               bb_perror_msg("vfork");
+               bb_simple_perror_msg("vfork");
  err:
                pid = 0;
        }
index 96dc4741afbd11eb3a1d4d6dbba0329ba56659a6..c71d914fcea05a1ceb3a58225e5a3f5cb704745b 100644 (file)
@@ -107,7 +107,7 @@ int crontab_main(int argc UNUSED_PARAM, char **argv)
        if (sanitize_env_if_suid()) { /* Clears dangerous stuff, sets PATH */
                /* Run by non-root */
                if (opt_ler & (OPT_u|OPT_c))
-                       bb_error_msg_and_die(bb_msg_you_must_be_root);
+                       bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
        }
 
        if (opt_ler & OPT_u) {
index 5aef64b602fa3cb16eef6f4384b159760b074b51..ef93c20bad0fc5207e59e2f8b7538e9a2ce7e869 100644 (file)
@@ -39,14 +39,14 @@ static unsigned check_under(void)
 {
        unsigned p = pointer;
        if (p == 0)
-               bb_error_msg_and_die("stack underflow");
+               bb_simple_error_msg_and_die("stack underflow");
        return p - 1;
 }
 
 static void push(double a)
 {
        if (pointer >= STACK_SIZE)
-               bb_error_msg_and_die("stack overflow");
+               bb_simple_error_msg_and_die("stack overflow");
        stack[pointer++] = a;
 }
 
index e4d104d0c44a6964cf90c47694dd3df3826542f8..f3d935b2e716499686d0438fb83ee6bbd9315f82 100644 (file)
@@ -344,14 +344,19 @@ static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found";
 /* Busybox stuff */
 #if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG
 #define info_logger(p, fmt, args...)                 bb_info_msg(fmt, ## args)
+#define simple_info_logger(p, msg)                   bb_simple_info_msg(msg)
 #define msg_logger(p, fmt, args...)                  bb_error_msg(fmt, ## args)
+#define simple_msg_logger(p, msg)                    bb_simple_error_msg(msg)
 #define msg_logger_and_die(p, fmt, args...)          bb_error_msg_and_die(fmt, ## args)
+#define simple_msg_logger_and_die(p, msg)            bb_simple_error_msg_and_die(msg)
 #define error_logger(p, fmt, args...)                bb_perror_msg(fmt, ## args)
 #define error_logger_and_die(p, fmt, args...)        bb_perror_msg_and_die(fmt, ## args)
 #else
 #define info_logger(p, fmt, args...)
 #define msg_logger(p, fmt, args...)
+#define simple_msg_logger(p, msg)
 #define msg_logger_and_die(p, fmt, args...)           exit(EXIT_FAILURE)
+#define simple_msg_logger_and_die(p, msg)             exit(EXIT_FAILURE)
 #define error_logger(p, fmt, args...)
 #define error_logger_and_die(p, fmt, args...)         exit(EXIT_FAILURE)
 #endif
@@ -727,7 +732,7 @@ static int do_servicing(int fd, unsigned long event_mask)
                caught_sighup = FALSE;
                return c_sighup;
        }
-       msg_logger_and_die(LOG_ERR, "read error on control file");
+       simple_msg_logger_and_die(LOG_ERR, "read error on control file");
 }   /*  End Function do_servicing  */
 
 static void service_name(const struct devfsd_notify_struct *info)
@@ -786,7 +791,7 @@ static void service_name(const struct devfsd_notify_struct *info)
                                action_compat(info, entry->action.what);
                                break;
                        default:
-                               msg_logger_and_die(LOG_ERR, "Unknown action");
+                               simple_msg_logger_and_die(LOG_ERR, "Unknown action");
                }
        }
 }   /*  End Function service_name  */
@@ -1691,7 +1696,7 @@ int st_expr_expand(char *output, unsigned int length, const char *input,
        }
        return FALSE;
 st_expr_expand_out:
-       info_logger(LOG_INFO, bb_msg_small_buffer);
+       simple_info_logger(LOG_INFO, bb_msg_small_buffer);
        return FALSE;
 }   /*  End Function st_expr_expand  */
 
@@ -1775,7 +1780,7 @@ static const char *expand_variable(char *buffer, unsigned int length,
                return input + len;
        }
        if (ch != ':' || ptr[1] != '-') {
-               info_logger(LOG_INFO, "illegal char in var name");
+               simple_info_logger(LOG_INFO, "illegal char in var name");
                return NULL;
        }
        /*  It's that handy "${var:-word}" expression. Check if var is defined  */
@@ -1838,7 +1843,7 @@ static const char *expand_variable(char *buffer, unsigned int length,
        *out_pos += len;
        return input;
 expand_variable_out:
-       info_logger(LOG_INFO, bb_msg_small_buffer);
+       simple_info_logger(LOG_INFO, bb_msg_small_buffer);
        return NULL;
 }   /*  End Function expand_variable  */
 
index 51ac3f22fcb35627da6346f75e24f0a447bb9c73..e8dce522553882de1387cb0f82b99d277c3f0f8d 100644 (file)
@@ -89,7 +89,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
                        fd,
                        target & ~(off_t)(page_size - 1));
        if (map_base == MAP_FAILED)
-               bb_perror_msg_and_die("mmap");
+               bb_simple_perror_msg_and_die("mmap");
 
 //     printf("Memory mapped at address %p.\n", map_base);
 
@@ -110,7 +110,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
                        read_result = *(volatile uint64_t*)virt_addr;
                        break;
                default:
-                       bb_error_msg_and_die("bad width");
+                       bb_simple_error_msg_and_die("bad width");
                }
 //             printf("Value at address 0x%"OFF_FMT"X (%p): 0x%llX\n",
 //                     target, virt_addr,
@@ -136,7 +136,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
 //                     read_result = *(volatile uint64_t*)virt_addr;
                        break;
                default:
-                       bb_error_msg_and_die("bad width");
+                       bb_simple_error_msg_and_die("bad width");
                }
 //             printf("Written 0x%llX; readback 0x%llX\n",
 //                             (unsigned long long)writeval,
@@ -145,7 +145,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
 
        if (ENABLE_FEATURE_CLEAN_UP) {
                if (munmap(map_base, mapped_size) == -1)
-                       bb_perror_msg_and_die("munmap");
+                       bb_simple_perror_msg_and_die("munmap");
                close(fd);
        }
 
index bba22d6d14b6d4293df3f110f791f92062956f05..1419578093159574aa409ef9474e0821a3980953 100644 (file)
@@ -183,7 +183,7 @@ static void fb_open(const char *strfb_device)
                        (G.scr_var.yres_virtual ?: G.scr_var.yres) * G.scr_fix.line_length,
                        PROT_WRITE, MAP_SHARED, fbfd, 0);
        if (G.addr == MAP_FAILED)
-               bb_perror_msg_and_die("mmap");
+               bb_simple_perror_msg_and_die("mmap");
 
        // point to the start of the visible screen
        G.addr += G.scr_var.yoffset * G.scr_fix.line_length + G.scr_var.xoffset * G.bytes_per_pixel;
index a3dabdadbbd0532f19528d625554eb06e09389d5..c76d9a699b2782e9cb0851e04ec0da35fdde9146 100644 (file)
@@ -120,7 +120,7 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv)
                                if (clmlen > 8)
                                        clmlen = 8;
                                if (clmlen == 0)
-                                       bb_error_msg_and_die("autoplacement selected and no empty space in oob");
+                                       bb_simple_error_msg_and_die("autoplacement selected and no empty space in oob");
                        } else {
                                /* Legacy mode */
                                switch (meminfo.oobsize) {
@@ -168,9 +168,9 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv)
                                if (errno == EOPNOTSUPP) {
                                        flags |= OPTION_N;
                                        if (flags & IS_NAND)
-                                               bb_error_msg_and_die("bad block check not available");
+                                               bb_simple_error_msg_and_die("bad block check not available");
                                } else {
-                                       bb_perror_msg_and_die("MEMGETBADBLOCK error");
+                                       bb_simple_perror_msg_and_die("MEMGETBADBLOCK error");
                                }
                        }
                }
index 342e240fa809189f71a0e527b20af11b26d63ea5..b453efba9f4dc77a75fa3132ed50cc618b451290 100644 (file)
@@ -810,7 +810,7 @@ static void identify(uint16_t *val)
                like_std = 3;
        } else
                /* "Unknown device type:\n\tbits 15&14 of general configuration word 0 both set to 1.\n" */
-               bb_error_msg_and_die("unknown device type");
+               bb_simple_error_msg_and_die("unknown device type");
 
        printf("%sremovable media\n", !(val[GEN_CONFIG] & MEDIA_REMOVABLE) ? "non-" : "");
        /* Info from the specific configuration word says whether or not the
@@ -1440,7 +1440,7 @@ static void flush_buffer_cache(/*int fd*/ void)
        sleep(1);
        if (ioctl(fd, HDIO_DRIVE_CMD, NULL) && errno != EINVAL) {       /* await completion */
                if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */
-                       bb_perror_msg("HDIO_DRIVE_CMD");
+                       bb_simple_perror_msg("HDIO_DRIVE_CMD");
                else
                        bb_perror_msg("ioctl %#x failed", HDIO_DRIVE_CMD);
        }
@@ -1506,7 +1506,7 @@ static void do_time(int cache /*,int fd*/)
        char *buf = xmalloc(TIMING_BUF_BYTES);
 
        if (mlock(buf, TIMING_BUF_BYTES))
-               bb_perror_msg_and_die("mlock");
+               bb_simple_perror_msg_and_die("mlock");
 
        /* Clear out the device request queues & give them time to complete.
         * NB: *small* delay. User is expected to have a clue and to not run
@@ -1857,7 +1857,7 @@ static void process_dev(char *devname)
                char buf[512];
                flush_buffer_cache();
                if (-1 == read(fd, buf, sizeof(buf)))
-                       bb_perror_msg("read of 512 bytes failed");
+                       bb_simple_perror_msg("read of 512 bytes failed");
        }
 #endif  /* HDIO_DRIVE_CMD */
        if (getset_mult || get_identity) {
@@ -1865,7 +1865,7 @@ static void process_dev(char *devname)
                if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount)) {
                        /* To be coherent with ioctl_or_warn. */
                        if (getset_mult && ENABLE_IOCTL_HEX2STR_ERROR)
-                               bb_perror_msg("HDIO_GET_MULTCOUNT");
+                               bb_simple_perror_msg("HDIO_GET_MULTCOUNT");
                        else
                                bb_perror_msg("ioctl %#x failed", HDIO_GET_MULTCOUNT);
                } else if (getset_mult) {
@@ -1985,7 +1985,7 @@ static void process_dev(char *devname)
                } else if (errno == -ENOMSG)
                        puts(" no identification info available");
                else if (ENABLE_IOCTL_HEX2STR_ERROR)  /* To be coherent with ioctl_or_warn */
-                       bb_perror_msg("HDIO_GET_IDENTITY");
+                       bb_simple_perror_msg("HDIO_GET_IDENTITY");
                else
                        bb_perror_msg("ioctl %#x failed", HDIO_GET_IDENTITY);
        }
index 5c2f4a555775cbd94a11e35be2f08d6a058ec8e4..898d773766d14e9c1fd964935d3ed6b7c183e0c7 100644 (file)
@@ -193,7 +193,7 @@ static int remap(unsigned cur_pos)
        );
        if (G.baseaddr == MAP_FAILED) {
                restore_term();
-               bb_perror_msg_and_die("mmap");
+               bb_simple_perror_msg_and_die("mmap");
        }
 
        G.current_byte = G.baseaddr + cur_pos;
index 7a2e8534a4fa15f051faeefa55172ab1981d2a43..82a559f74a2be2426ebfea1a506d8aaa09bc0a11 100644 (file)
@@ -344,7 +344,7 @@ static void get_funcs_matrix(int fd, unsigned long *funcs)
 static void check_funcs_test_end(int funcs, int pec, const char *err)
 {
        if (pec && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C)))
-               bb_error_msg("warning: adapter does not support PEC");
+               bb_simple_error_msg("warning: adapter does not support PEC");
 
        if (err)
                bb_error_msg_and_die(
@@ -392,7 +392,7 @@ static void check_read_funcs(int fd, int mode, int data_addr, int pec)
                break;
 #endif /* ENABLE_I2CDUMP */
        default:
-               bb_error_msg_and_die("internal error");
+               bb_simple_error_msg_and_die("internal error");
        }
        check_funcs_test_end(funcs, pec, err);
 }
@@ -438,7 +438,7 @@ static void confirm_or_abort(void)
 {
        fprintf(stderr, "Continue? [y/N] ");
        if (!bb_ask_y_confirmation())
-               bb_error_msg_and_die("aborting");
+               bb_simple_error_msg_and_die("aborting");
 }
 
 /*
@@ -449,20 +449,20 @@ static void confirm_or_abort(void)
  */
 static void confirm_action(int bus_addr, int mode, int data_addr, int pec)
 {
-       bb_error_msg("WARNING! This program can confuse your I2C bus");
+       bb_simple_error_msg("WARNING! This program can confuse your I2C bus");
 
        /* Don't let the user break his/her EEPROMs */
        if (bus_addr >= 0x50 && bus_addr <= 0x57 && pec) {
-               bb_error_msg_and_die("this is I2C not smbus - using PEC on I2C "
+               bb_simple_error_msg_and_die("this is I2C not smbus - using PEC on I2C "
                        "devices may result in data loss, aborting");
        }
 
        if (mode == I2C_SMBUS_BYTE && data_addr >= 0 && pec)
-               bb_error_msg("WARNING! May interpret a write byte command "
+               bb_simple_error_msg("WARNING! May interpret a write byte command "
                        "with PEC as a write byte data command");
 
        if (pec)
-               bb_error_msg("PEC checking enabled");
+               bb_simple_error_msg("PEC checking enabled");
 
        confirm_or_abort();
 }
@@ -507,7 +507,7 @@ int i2cget_main(int argc UNUSED_PARAM, char **argv)
                        case 'w':       mode = I2C_SMBUS_WORD_DATA;     break;
                        case 'c':       mode = I2C_SMBUS_BYTE;          break;
                        default:
-                               bb_error_msg("invalid mode");
+                               bb_simple_error_msg("invalid mode");
                                bb_show_usage();
                        }
                        pec = argv[3][1] == 'p';
@@ -529,7 +529,7 @@ int i2cget_main(int argc UNUSED_PARAM, char **argv)
                if (data_addr >= 0) {
                        status = i2c_smbus_write_byte(fd, data_addr);
                        if (status < 0)
-                               bb_error_msg("warning - write failed");
+                               bb_simple_error_msg("warning - write failed");
                }
                status = i2c_smbus_read_byte(fd);
                break;
@@ -542,7 +542,7 @@ int i2cget_main(int argc UNUSED_PARAM, char **argv)
        close(fd);
 
        if (status < 0)
-               bb_perror_msg_and_die("read failed");
+               bb_simple_perror_msg_and_die("read failed");
 
        printf("0x%0*x\n", mode == I2C_SMBUS_WORD_DATA ? 4 : 2, status);
 
@@ -611,7 +611,7 @@ int i2cset_main(int argc, char **argv)
                        case 'i': mode = I2C_SMBUS_I2C_BLOCK_DATA;
                                break;
                        default:
-                               bb_error_msg("invalid mode");
+                               bb_simple_error_msg("invalid mode");
                                bb_show_usage();
                        }
 
@@ -620,11 +620,11 @@ int i2cset_main(int argc, char **argv)
                         || mode == I2C_SMBUS_I2C_BLOCK_DATA
                        ) {
                                if (pec && mode == I2C_SMBUS_I2C_BLOCK_DATA)
-                                       bb_error_msg_and_die(
+                                       bb_simple_error_msg_and_die(
                                                "PEC not supported for I2C "
                                                "block writes");
                                if (opts & opt_m)
-                                       bb_error_msg_and_die(
+                                       bb_simple_error_msg_and_die(
                                                "mask not supported for block "
                                                "writes");
                        }
@@ -685,7 +685,7 @@ int i2cset_main(int argc, char **argv)
                }
 
                if (tmpval < 0)
-                       bb_perror_msg_and_die("can't read old value");
+                       bb_simple_perror_msg_and_die("can't read old value");
 
                val = (val & mask) | (tmpval & ~mask);
 
@@ -724,7 +724,7 @@ int i2cset_main(int argc, char **argv)
                break;
        }
        if (status < 0)
-               bb_perror_msg_and_die("write failed");
+               bb_simple_perror_msg_and_die("write failed");
 
        if (pec)
                i2c_set_pec(fd, 0); /* Clear PEC. */
@@ -978,12 +978,12 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
                case 's': mode = I2C_SMBUS_BLOCK_DATA;          break;
                case 'i': mode = I2C_SMBUS_I2C_BLOCK_DATA;      break;
                default:
-                       bb_error_msg_and_die("invalid mode");
+                       bb_simple_error_msg_and_die("invalid mode");
                }
 
                if (argv[2][1] == 'p') {
                        if (argv[2][0] == 'W' || argv[2][0] == 'i') {
-                               bb_error_msg_and_die(
+                               bb_simple_error_msg_and_die(
                                        "pec not supported for -W and -i");
                        } else {
                                pec = 1;
@@ -994,7 +994,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
        if (opts & opt_r) {
                first = strtol(opt_r_str, &dash, 0);
                if (dash == opt_r_str || *dash != '-' || first > 0xff)
-                       bb_error_msg_and_die("invalid range");
+                       bb_simple_error_msg_and_die("invalid range");
                last = xstrtou_range(++dash, 0, first, 0xff);
 
                /* Range is not available for every mode. */
@@ -1007,7 +1007,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
                                break;
                        /* Fall through */
                default:
-                       bb_error_msg_and_die(
+                       bb_simple_error_msg_and_die(
                                "range not compatible with selected mode");
                }
        }
@@ -1032,7 +1032,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
                if (mode == I2C_SMBUS_BYTE) {
                        res = i2c_smbus_write_byte(fd, first);
                        if (res < 0)
-                               bb_perror_msg_and_die("write start address");
+                               bb_simple_perror_msg_and_die("write start address");
                }
 
                dump_data(fd, mode, first, last, block, blen);
@@ -1398,7 +1398,7 @@ static void check_i2c_func(int fd)
        get_funcs_matrix(fd, &funcs);
 
        if (!(funcs & I2C_FUNC_I2C))
-               bb_error_msg_and_die("adapter does not support I2C transfers");
+               bb_simple_error_msg_and_die("adapter does not support I2C transfers");
 }
 
 //usage:#define i2ctransfer_trivial_usage
@@ -1451,7 +1451,7 @@ int i2ctransfer_main(int argc UNUSED_PARAM, char **argv)
                char *end;
 
                if (nmsgs >= I2C_RDWR_IOCTL_MAX_MSGS)
-                       bb_error_msg_and_die("too many messages, max: "I2C_RDWR_IOCTL_MAX_MSGS_STR);
+                       bb_simple_error_msg_and_die("too many messages, max: "I2C_RDWR_IOCTL_MAX_MSGS_STR);
 
                flags = 0;
                arg_ptr = *argv;
index ec0321941f63f93d259b92e9cb47768933644a2d..8bff86ae5fec6381bf378cd931b76b9141e4e2dc 100644 (file)
@@ -117,7 +117,7 @@ int inotifyd_main(int argc, char **argv)
        // open inotify
        pfd.fd = inotify_init();
        if (pfd.fd < 0)
-               bb_perror_msg_and_die("no kernel support");
+               bb_simple_perror_msg_and_die("no kernel support");
 
        // setup watches
        while (*++argv) {
index 09bcaaf63466197df01c484e07428ea1a9ca6190..f111c6363fe4ca6492e2213854c681ec3f80a106 100644 (file)
@@ -101,7 +101,7 @@ static unsigned next_good_eraseblock(int fd, struct mtd_info_user *meminfo,
 
                if (block_offset >= meminfo->size) {
                        if (IS_NANDWRITE)
-                               bb_error_msg_and_die("not enough space in MTD device");
+                               bb_simple_error_msg_and_die("not enough space in MTD device");
                        return block_offset; /* let the caller exit */
                }
                offs = block_offset;
@@ -174,7 +174,7 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
        meminfo_writesize = meminfo.writesize;
 
        if (mtdoffset & (meminfo_writesize - 1))
-               bb_error_msg_and_die("start address is not page aligned");
+               bb_simple_error_msg_and_die("start address is not page aligned");
 
        filebuf = xmalloc(meminfo_writesize);
        oobbuf = xmalloc(meminfo.oobsize);
@@ -248,9 +248,9 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
                }
                if (cnt < meminfo_writesize) {
                        if (IS_NANDDUMP)
-                               bb_error_msg_and_die("short read");
+                               bb_simple_error_msg_and_die("short read");
                        if (!(opts & OPT_p))
-                               bb_error_msg_and_die("input size is not rounded up to page size, "
+                               bb_simple_error_msg_and_die("input size is not rounded up to page size, "
                                                "use -p to zero pad");
                        /* zero pad to end of write block */
                        memset(filebuf + cnt, 0, meminfo_writesize - cnt);
@@ -273,7 +273,7 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
                /* We filled entire MTD, but did we reach EOF on input? */
                if (full_read(STDIN_FILENO, filebuf, meminfo_writesize) != 0) {
                        /* no */
-                       bb_error_msg_and_die("not enough space in MTD device");
+                       bb_simple_error_msg_and_die("not enough space in MTD device");
                }
        }
 
index 766bad8c76d3f758adca0d1abe2526fd656ce559..db7c83750f29fb9bbc3b62cd879e1d9a08cebe54 100644 (file)
@@ -88,7 +88,7 @@ int rfkill_main(int argc UNUSED_PARAM, char **argv)
 
        rf_fd = device_open("/dev/rfkill", mode);
        if (rf_fd < 0)
-               bb_perror_msg_and_die("/dev/rfkill");
+               bb_simple_perror_msg_and_die("/dev/rfkill");
 
        if (rf_opt & OPT_l) {
                while (full_read(rf_fd, &event, sizeof(event)) == RFKILL_EVENT_SIZE_V1) {
index 874a3f0a33a5667abbaef568212bd1161bb68d02..319ec1d497c115f392028c4adcb61e77f0ec6137 100644 (file)
@@ -120,7 +120,7 @@ static int receive(/*int read_fd, */int file_fd)
                /* Write previously received block */
                errno = 0;
                if (full_write(file_fd, blockBuf, blockLength) != blockLength) {
-                       bb_perror_msg(bb_msg_write_error);
+                       bb_simple_perror_msg(bb_msg_write_error);
                        goto fatal;
                }
 
@@ -150,7 +150,7 @@ static int receive(/*int read_fd, */int file_fd)
                        goto timeout;
 
                if (blockNo != (255 - blockNoOnesCompl)) {
-                       bb_error_msg("bad block ones compl");
+                       bb_simple_error_msg("bad block ones compl");
                        goto error;
                }
 
@@ -229,7 +229,7 @@ static int receive(/*int read_fd, */int file_fd)
                                do_crc = 0;
                                goto timeout;
                        }
-                       bb_error_msg("too many errors; giving up");
+                       bb_simple_error_msg("too many errors; giving up");
  fatal:
                        /* 5 CAN followed by 5 BS. Don't try too hard... */
                        safe_write(write_fd, "\030\030\030\030\030\010\010\010\010\010", 10);
index 064888ab818ad62635e33e29501a25a889d5d0d3..d15d363f3bc38c85f32a2b023c3a7f4a33e1dcd1 100644 (file)
@@ -88,7 +88,7 @@ static void resuse_end(pid_t pid, resource_t *resp)
         * returns the child process, set the time the command finished. */
        while ((caught = wait3(&resp->waitstatus, 0, &resp->ru)) != pid) {
                if (caught == -1 && errno != EINTR) {
-                       bb_perror_msg("wait");
+                       bb_simple_perror_msg("wait");
                        return;
                }
        }
index dc7af25a468c0fecce6f675d444c4f8664696e8a..8318df0f99f1bf95dc558aad7379d1865b1966d7 100644 (file)
@@ -234,10 +234,10 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
                        //      bb_error_msg_and_die("%s invalid maximum size calculated", "UBI");
                } else
                if (!(opts & OPTION_s))
-                       bb_error_msg_and_die("size not specified");
+                       bb_simple_error_msg_and_die("size not specified");
 
                if (!(opts & OPTION_N))
-                       bb_error_msg_and_die("name not specified");
+                       bb_simple_error_msg_and_die("name not specified");
 
                /* the structure is memset(0) above */
                mkvol_req.vol_id = vol_id;
@@ -264,7 +264,7 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
 //usage:     "\n       -N VOLNAME      Volume name"
        if (do_rmvol) {
                if (!(opts & (OPTION_n|OPTION_N)))
-                       bb_error_msg_and_die("volume id not specified");
+                       bb_simple_error_msg_and_die("volume id not specified");
 
                if (opts & OPTION_N) {
                        unsigned num = ubi_devnum_from_devname(ubi_ctrl);
@@ -288,9 +288,9 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
 //usage:     "\n       -s SIZE         Size in bytes"
        if (do_rsvol) {
                if (!(opts & OPTION_s))
-                       bb_error_msg_and_die("size not specified");
+                       bb_simple_error_msg_and_die("size not specified");
                if (!(opts & OPTION_n))
-                       bb_error_msg_and_die("volume id not specified");
+                       bb_simple_error_msg_and_die("volume id not specified");
 
                rsvol_req.bytes = size_bytes; /* signed int64_t */
                rsvol_req.vol_id = vol_id;
index 21bd1011103d4e400fec2cf7d3136f2ac8eb67b2..e7c56640c63ac122395701d7cc983806dd2b8fef 100644 (file)
@@ -72,7 +72,7 @@ int ubirename_main(int argc, char **argv)
        rnvol = xzalloc(sizeof(*rnvol));
        rnvol->count = --argc;
        if (argc > ARRAY_SIZE(rnvol->ents))
-               bb_error_msg_and_die("too many renames requested");
+               bb_simple_error_msg_and_die("too many renames requested");
 
        ubi_devname = argv[1];
        ubi_devnum = ubi_devnum_from_devname(ubi_devname);
index 1a30dd87cc7a3ef5cbead6ac583fb9a16b1ea674..ac863248121365a82d6de4c2be74fea50cbb2481 100644 (file)
@@ -2600,7 +2600,7 @@ static void new_get_kernel_symbols(void)
                        module_names = xrealloc(module_names, bufsize);
                        goto retry_modules_load;
                }
-               bb_perror_msg_and_die("QM_MODULES");
+               bb_simple_perror_msg_and_die("QM_MODULES");
        }
 
        n_ext_modules = nmod = ret;
@@ -2661,7 +2661,7 @@ static void new_get_kernel_symbols(void)
                        syms = xrealloc(syms, bufsize);
                        goto retry_kern_sym_load;
                }
-               bb_perror_msg_and_die("kernel: QM_SYMBOLS");
+               bb_simple_perror_msg_and_die("kernel: QM_SYMBOLS");
        }
        nksyms = nsyms = ret;
        ksyms = syms;
@@ -3247,21 +3247,21 @@ static struct obj_file *obj_load(char *image, size_t image_size, int loadprogbit
        f->load_order_search_start = &f->load_order;
 
        if (image_size < sizeof(f->header))
-               bb_error_msg_and_die("error while loading ELF header");
+               bb_simple_error_msg_and_die("error while loading ELF header");
        memcpy(&f->header, image, sizeof(f->header));
 
        if (*(aliased_uint32_t*)(&f->header.e_ident) != ELFMAG_U32) {
-               bb_error_msg_and_die("not an ELF file");
+               bb_simple_error_msg_and_die("not an ELF file");
        }
        if (f->header.e_ident[EI_CLASS] != ELFCLASSM
         || f->header.e_ident[EI_DATA] != (BB_BIG_ENDIAN ? ELFDATA2MSB : ELFDATA2LSB)
         || f->header.e_ident[EI_VERSION] != EV_CURRENT
         || !MATCH_MACHINE(f->header.e_machine)
        ) {
-               bb_error_msg_and_die("ELF file not for this architecture");
+               bb_simple_error_msg_and_die("ELF file not for this architecture");
        }
        if (f->header.e_type != ET_REL) {
-               bb_error_msg_and_die("ELF file not a relocatable object");
+               bb_simple_error_msg_and_die("ELF file not a relocatable object");
        }
 
        /* Read the section headers.  */
@@ -3280,7 +3280,7 @@ static struct obj_file *obj_load(char *image, size_t image_size, int loadprogbit
 
        section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
        if (image_size < f->header.e_shoff + sizeof(ElfW(Shdr)) * shnum)
-               bb_error_msg_and_die("error while loading section headers");
+               bb_simple_error_msg_and_die("error while loading section headers");
        memcpy(section_headers, image + f->header.e_shoff, sizeof(ElfW(Shdr)) * shnum);
 
        /* Read the section data.  */
@@ -3317,16 +3317,16 @@ static struct obj_file *obj_load(char *image, size_t image_size, int loadprogbit
                                if (sec->header.sh_size > 0) {
                                        sec->contents = xmalloc(sec->header.sh_size);
                                        if (image_size < (sec->header.sh_offset + sec->header.sh_size))
-                                               bb_error_msg_and_die("error while loading section data");
+                                               bb_simple_error_msg_and_die("error while loading section data");
                                        memcpy(sec->contents, image + sec->header.sh_offset, sec->header.sh_size);
                                }
                                break;
 #if SHT_RELM == SHT_REL
                        case SHT_RELA:
-                               bb_error_msg_and_die("RELA relocations not supported on this architecture");
+                               bb_simple_error_msg_and_die("RELA relocations not supported on this architecture");
 #else
                        case SHT_REL:
-                               bb_error_msg_and_die("REL relocations not supported on this architecture");
+                               bb_simple_error_msg_and_die("REL relocations not supported on this architecture");
 #endif
                        default:
                                if (sec->header.sh_type >= SHT_LOPROC) {
@@ -3447,7 +3447,7 @@ static int obj_load_progbits(char *image, size_t image_size, struct obj_file *f,
                        continue;
                sec->contents = imagebase + (sec->header.sh_addr - base);
                if (image_size < (sec->header.sh_offset + sec->header.sh_size)) {
-                       bb_error_msg("error reading ELF section data");
+                       bb_simple_error_msg("error reading ELF section data");
                        return 0; /* need to delete half-loaded module! */
                }
                memcpy(sec->contents, image + sec->header.sh_offset, sec->header.sh_size);
@@ -3845,7 +3845,7 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
                if (m_has_modinfo) {
                        int m_version = new_get_module_version(f, m_strversion);
                        if (m_version == -1) {
-                               bb_error_msg_and_die("can't find the kernel version "
+                               bb_simple_error_msg_and_die("can't find the kernel version "
                                        "the module was compiled for");
                        }
                }
@@ -3864,7 +3864,7 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
 #endif
 
        if (query_module(NULL, 0, NULL, 0, NULL))
-               bb_error_msg_and_die("old (unsupported) kernel");
+               bb_simple_error_msg_and_die("old (unsupported) kernel");
        new_get_kernel_symbols();
        k_crcs = new_is_kernel_checksummed();
 
index a3548879c0953a4194129e72589a3e388da41ae2..8d4639f50db78bb26ccf7d0ae748151aa66a88b9 100644 (file)
@@ -52,7 +52,7 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
                /* Unload _all_ unused modules via NULL delete_module() call */
                err = bb_delete_module(NULL, flags);
                if (err && err != EFAULT)
-                       bb_perror_msg_and_die("rmmod");
+                       bb_simple_perror_msg_and_die("rmmod");
                return EXIT_SUCCESS;
        }
 
index 71bfe3cbf96082a75d3501d18cabd77cce53bf3a..6519f8156c3f4bab13e71550716e8f89b3fad7f5 100644 (file)
@@ -116,7 +116,7 @@ static int arp_del(char **args)
        /* Resolve the host name. */
        host = *args;
        if (ap->input(host, &sa) < 0) {
-               bb_herror_msg_and_die("%s", host);
+               bb_simple_herror_msg_and_die(host);
        }
 
        /* If a host has more than one address, use the correct one! */
@@ -149,7 +149,7 @@ static int arp_del(char **args)
 #ifdef HAVE_ATF_DONTPUB
                        req.arp_flags |= ATF_DONTPUB;
 #else
-                       bb_error_msg("feature ATF_DONTPUB is not supported");
+                       bb_simple_error_msg("feature ATF_DONTPUB is not supported");
 #endif
                        args++;
                        break;
@@ -157,7 +157,7 @@ static int arp_del(char **args)
 #ifdef HAVE_ATF_MAGIC
                        req.arp_flags |= ATF_MAGIC;
 #else
-                       bb_error_msg("feature ATF_MAGIC is not supported");
+                       bb_simple_error_msg("feature ATF_MAGIC is not supported");
 #endif
                        args++;
                        break;
@@ -173,7 +173,7 @@ static int arp_del(char **args)
                        if (strcmp(*args, "255.255.255.255") != 0) {
                                host = *args;
                                if (ap->input(host, &sa) < 0) {
-                                       bb_herror_msg_and_die("%s", host);
+                                       bb_simple_herror_msg_and_die(host);
                                }
                                memcpy(&req.arp_netmask, &sa, sizeof(struct sockaddr));
                                req.arp_flags |= ATF_NETMASK;
@@ -195,7 +195,7 @@ static int arp_del(char **args)
        /* Call the kernel. */
        if (flags & 2) {
                if (option_mask32 & ARP_OPT_v)
-                       bb_error_msg("SIOCDARP(nopub)");
+                       bb_simple_error_msg("SIOCDARP(nopub)");
                err = ioctl(sockfd, SIOCDARP, &req);
                if (err < 0) {
                        if (errno == ENXIO) {
@@ -204,20 +204,20 @@ static int arp_del(char **args)
                                printf("No ARP entry for %s\n", host);
                                return -1;
                        }
-                       bb_perror_msg_and_die("SIOCDARP(priv)");
+                       bb_simple_perror_msg_and_die("SIOCDARP(priv)");
                }
        }
        if ((flags & 1) && err) {
  nopub:
                req.arp_flags |= ATF_PUBL;
                if (option_mask32 & ARP_OPT_v)
-                       bb_error_msg("SIOCDARP(pub)");
+                       bb_simple_error_msg("SIOCDARP(pub)");
                if (ioctl(sockfd, SIOCDARP, &req) < 0) {
                        if (errno == ENXIO) {
                                printf("No ARP entry for %s\n", host);
                                return -1;
                        }
-                       bb_perror_msg_and_die("SIOCDARP(pub)");
+                       bb_simple_perror_msg_and_die("SIOCDARP(pub)");
                }
        }
        return 0;
@@ -233,7 +233,7 @@ static void arp_getdevhw(char *ifname, struct sockaddr *sa)
        ioctl_or_perror_and_die(sockfd, SIOCGIFHWADDR, &ifr,
                                        "can't get HW-Address for '%s'", ifname);
        if (hw_set && (ifr.ifr_hwaddr.sa_family != hw->type)) {
-               bb_error_msg_and_die("protocol type mismatch");
+               bb_simple_error_msg_and_die("protocol type mismatch");
        }
        memcpy(sa, &(ifr.ifr_hwaddr), sizeof(struct sockaddr));
 
@@ -261,20 +261,20 @@ static int arp_set(char **args)
 
        host = *args++;
        if (ap->input(host, &sa) < 0) {
-               bb_herror_msg_and_die("%s", host);
+               bb_simple_herror_msg_and_die(host);
        }
        /* If a host has more than one address, use the correct one! */
        memcpy(&req.arp_pa, &sa, sizeof(struct sockaddr));
 
        /* Fetch the hardware address. */
        if (*args == NULL) {
-               bb_error_msg_and_die("need hardware address");
+               bb_simple_error_msg_and_die("need hardware address");
        }
        if (option_mask32 & ARP_OPT_D) {
                arp_getdevhw(*args++, &req.arp_ha);
        } else {
                if (hw->input(*args++, &req.arp_ha) < 0) {
-                       bb_error_msg_and_die("invalid hardware address");
+                       bb_simple_error_msg_and_die("invalid hardware address");
                }
        }
 
@@ -302,7 +302,7 @@ static int arp_set(char **args)
 #ifdef HAVE_ATF_DONTPUB
                        flags |= ATF_DONTPUB;
 #else
-                       bb_error_msg("feature ATF_DONTPUB is not supported");
+                       bb_simple_error_msg("feature ATF_DONTPUB is not supported");
 #endif
                        args++;
                        break;
@@ -310,7 +310,7 @@ static int arp_set(char **args)
 #ifdef HAVE_ATF_MAGIC
                        flags |= ATF_MAGIC;
 #else
-                       bb_error_msg("feature ATF_MAGIC is not supported");
+                       bb_simple_error_msg("feature ATF_MAGIC is not supported");
 #endif
                        args++;
                        break;
@@ -326,7 +326,7 @@ static int arp_set(char **args)
                        if (strcmp(*args, "255.255.255.255") != 0) {
                                host = *args;
                                if (ap->input(host, &sa) < 0) {
-                                       bb_herror_msg_and_die("%s", host);
+                                       bb_simple_herror_msg_and_die(host);
                                }
                                memcpy(&req.arp_netmask, &sa, sizeof(struct sockaddr));
                                flags |= ATF_NETMASK;
@@ -346,7 +346,7 @@ static int arp_set(char **args)
 
        /* Call the kernel. */
        if (option_mask32 & ARP_OPT_v)
-               bb_error_msg("SIOCSARP()");
+               bb_simple_error_msg("SIOCSARP()");
        xioctl(sockfd, SIOCSARP, &req);
        return 0;
 }
@@ -422,7 +422,7 @@ static int arp_show(char *name)
        if (name != NULL) {
                /* Resolve the host name. */
                if (ap->input(name, &sa) < 0) {
-                       bb_herror_msg_and_die("%s", name);
+                       bb_simple_herror_msg_and_die(name);
                }
                host = xstrdup(ap->sprint(&sa, 1));
        }
@@ -530,7 +530,7 @@ int arp_main(int argc UNUSED_PARAM, char **argv)
        /* Now see what we have to do here... */
        if (opts & (ARP_OPT_d | ARP_OPT_s)) {
                if (argv[0] == NULL)
-                       bb_error_msg_and_die("need host name");
+                       bb_simple_error_msg_and_die("need host name");
                if (opts & ARP_OPT_s)
                        return arp_set(argv);
                return arp_del(argv);
index 901578b6803e8008ffa5122da622b3f57969dd90..2a256aaa06934d5e0446703ab5f57bebf38b62e4 100644 (file)
@@ -375,7 +375,7 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
                        xconnect(probe_fd, (struct sockaddr *) &G.probe_saddr, sizeof(G.probe_saddr));
                        bb_getsockname(probe_fd, (struct sockaddr *) &G.probe_saddr, sizeof(G.probe_saddr));
                        if (G.probe_saddr.sin_family != AF_INET)
-                               bb_error_msg_and_die("no IP address configured");
+                               bb_simple_error_msg_and_die("no IP address configured");
                        src = G.probe_saddr.sin_addr;
                }
                close(probe_fd);
@@ -430,7 +430,7 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
                /* Don't allow SIGALRMs while we process the reply */
                sigprocmask(SIG_BLOCK, &G.sset, NULL);
                if (cc < 0) {
-                       bb_perror_msg("recvfrom");
+                       bb_simple_perror_msg("recvfrom");
                        continue;
                }
                recv_pack(G.packet, cc, &from);
index f2c6bddc616b63c6eb047d26382ed5fb3ace1cfd..0ff0290fb275fe266144666c583df0ae03a4b2f6 100644 (file)
@@ -395,11 +395,11 @@ static int process_packet(struct dns_entry *conf_data,
 
        head = (struct dns_head *)buf;
        if (head->nquer == 0) {
-               bb_error_msg("packet has 0 queries, ignored");
+               bb_simple_error_msg("packet has 0 queries, ignored");
                return 0; /* don't reply */
        }
        if (head->flags & htons(0x8000)) { /* QR bit */
-               bb_error_msg("response packet, ignored");
+               bb_simple_error_msg("response packet, ignored");
                return 0; /* don't reply */
        }
        /* QR = 1 "response", RCODE = 4 "Not Implemented" */
@@ -474,7 +474,7 @@ static int process_packet(struct dns_entry *conf_data,
         * RCODE = 0 "success"
         */
        if (OPT_verbose)
-               bb_info_msg("returning positive reply");
+               bb_simple_info_msg("returning positive reply");
        outr_flags = htons(0x8000 | 0x0400 | 0);
        /* we have one answer */
        head->nansw = htons(1);
@@ -557,7 +557,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv)
                        continue;
                }
                if (OPT_verbose)
-                       bb_info_msg("got UDP packet");
+                       bb_simple_info_msg("got UDP packet");
                buf[r] = '\0'; /* paranoia */
                r = process_packet(conf_data, conf_ttl, buf);
                if (r <= 0)
index acaac16f8ead12a33a66dbba7545b4d05d37f11c..f45d4360905a582bf2367041cb6d9a993ea2fcaf 100644 (file)
@@ -182,7 +182,7 @@ static int get_wol_pw(const char *ethoptarg, unsigned char *wol_passwd)
                byte_cnt = sscanf(ethoptarg, "%u.%u.%u.%u",
                                  &passwd[0], &passwd[1], &passwd[2], &passwd[3]);
        if (byte_cnt < 4) {
-               bb_error_msg("can't read Wake-On-LAN pass");
+               bb_simple_error_msg("can't read Wake-On-LAN pass");
                return 0;
        }
 // TODO: check invalid numbers >255??
@@ -266,7 +266,7 @@ int ether_wake_main(int argc UNUSED_PARAM, char **argv)
        /* This is necessary for broadcasts to work */
        if (flags /* & 1 OPT_BROADCAST */) {
                if (setsockopt_broadcast(s) != 0)
-                       bb_perror_msg("SO_BROADCAST");
+                       bb_simple_perror_msg("SO_BROADCAST");
        }
 
 #if defined(PF_PACKET)
index cb6910fb0ff1c7d0d065e55302ab61b5831c3d53..6f7f7e9ca32de3e99eda5eddb7128daf3c7cfb46 100644 (file)
@@ -214,7 +214,7 @@ int ftp_receive(const char *local_path, char *server_path)
                struct stat sbuf;
                /* lstat would be wrong here! */
                if (stat(local_path, &sbuf) < 0) {
-                       bb_perror_msg_and_die("stat");
+                       bb_simple_perror_msg_and_die("stat");
                }
                if (sbuf.st_size > 0) {
                        beg_range = sbuf.st_size;
index 248d8b65a7f9bb7c70ebd0046e906e21bc713ccd..f96daed95968219e38a965dcf227ef963e2b7daf 100644 (file)
@@ -61,7 +61,7 @@ static void do_sethostname(char *s, int isfile)
        } else if (sethostname(s, strlen(s))) {
 //             if (errno == EPERM)
 //                     bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
-               bb_perror_msg_and_die("sethostname");
+               bb_simple_perror_msg_and_die("sethostname");
        }
 }
 
index a0a4abc1008e9a8e51efd444a75f9b4e8a47ffaa..1757e09c958dcbc59abb77b60166bae6e0214df5 100644 (file)
@@ -1025,7 +1025,7 @@ static void log_and_exit(void)
        */
 
        if (verbose > 2)
-               bb_error_msg("closed");
+               bb_simple_error_msg("closed");
        _exit(xfunc_error_retval);
 }
 
@@ -1220,7 +1220,7 @@ static void send_headers(unsigned responseNum)
        }
        if (full_write(STDOUT_FILENO, iobuf, len) != len) {
                if (verbose > 1)
-                       bb_perror_msg("error");
+                       bb_simple_perror_msg("error");
                log_and_exit();
        }
 }
@@ -1838,7 +1838,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
        if (count < 0) {
  IF_FEATURE_USE_SENDFILE(fin:)
                if (verbose > 1)
-                       bb_perror_msg("error");
+                       bb_simple_perror_msg("error");
        }
        log_and_exit();
 }
@@ -2149,7 +2149,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
                if (rmt_ip_str)
                        applet_name = rmt_ip_str;
                if (verbose > 2)
-                       bb_error_msg("connected");
+                       bb_simple_error_msg("connected");
        }
        if_ip_denied_send_HTTP_FORBIDDEN_and_exit(remote_ip);
 
@@ -2746,7 +2746,7 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
                if (opt & OPT_SETUID) {
                        if (ugid.gid != (gid_t)-1) {
                                if (setgroups(1, &ugid.gid) == -1)
-                                       bb_perror_msg_and_die("setgroups");
+                                       bb_simple_perror_msg_and_die("setgroups");
                                xsetgid(ugid.gid);
                        }
                        xsetuid(ugid.uid);
index 5c47abc1631e6c95bbea7207bbe455bcf25dac75..b566d91a9e0472ff720b33e6604c6369dfeec3fd 100644 (file)
@@ -361,7 +361,7 @@ int ifconfig_main(int argc UNUSED_PARAM, char **argv)
 #if ENABLE_FEATURE_IFCONFIG_STATUS
                return display_interfaces(argv[0] ? argv[0] : show_all_param);
 #else
-               bb_error_msg_and_die("no support for status display");
+               bb_simple_error_msg_and_die("no support for status display");
 #endif
        }
 
index b7b26c1136300d90e5f3833fede9983faf2a1f1a..fa18edd577e694c47d78436efaca56fa6a6802af 100644 (file)
@@ -365,7 +365,7 @@ static void up_iface(void)
        if (!(ifrequest.ifr_flags & IFF_UP)) {
                ifrequest.ifr_flags |= IFF_UP;
                /* Let user know we mess up with interface */
-               bb_info_msg("upping interface");
+               bb_simple_info_msg("upping interface");
                if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) {
                        if (errno != ENODEV && errno != EADDRNOTAVAIL)
                                xfunc_die();
@@ -461,7 +461,7 @@ static smallint detect_link(void)
                else if (option_mask32 & FLAG_IGNORE_FAIL_POSITIVE)
                        status = IFSTATUS_UP;
                else if (G.api_mode[0] == 'a')
-                       bb_error_msg("can't detect link status");
+                       bb_simple_error_msg("can't detect link status");
        }
 
        if (status != G.iface_last_status) {
@@ -493,14 +493,14 @@ static NOINLINE int check_existence_through_netlink(void)
                                goto ret;
                        if (errno == EINTR)
                                continue;
-                       bb_perror_msg("netlink: recv");
+                       bb_simple_perror_msg("netlink: recv");
                        return -1;
                }
 
                mhdr = (struct nlmsghdr*)replybuf;
                while (bytes > 0) {
                        if (!NLMSG_OK(mhdr, bytes)) {
-                               bb_error_msg("netlink packet too small or truncated");
+                               bb_simple_error_msg("netlink packet too small or truncated");
                                return -1;
                        }
 
@@ -509,7 +509,7 @@ static NOINLINE int check_existence_through_netlink(void)
                                int attr_len;
 
                                if (mhdr->nlmsg_len < NLMSG_LENGTH(sizeof(struct ifinfomsg))) {
-                                       bb_error_msg("netlink packet too small or truncated");
+                                       bb_simple_error_msg("netlink packet too small or truncated");
                                        return -1;
                                }
 
@@ -591,7 +591,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
        }
 
        if (pid_from_pidfile > 0 && kill(pid_from_pidfile, 0) == 0)
-               bb_error_msg_and_die("daemon already running");
+               bb_simple_error_msg_and_die("daemon already running");
 #endif
 
        api_mode_found = strchr(api_modes, G.api_mode[0]);
@@ -690,7 +690,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
                ) {
                        if (errno == EINTR)
                                continue;
-                       bb_perror_msg("poll");
+                       bb_simple_perror_msg("poll");
                        goto exiting;
                }
 
@@ -763,5 +763,5 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
 
  exiting:
        remove_pidfile(pidfile_name);
-       bb_error_msg_and_die("exiting");
+       bb_simple_error_msg_and_die("exiting");
 }
index 5327b09793aa441a47396fc89172803ac1b5416e..60ceb5a1f1af5f0cc7cc8edfb6e0fc467db32a3a 100644 (file)
@@ -665,7 +665,7 @@ static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec)
                if (executable_exists(ext_dhcp_clients[i].name))
                        return execute(ext_dhcp_clients[i].startcmd, ifd, exec);
        }
-       bb_error_msg("no dhcp clients found");
+       bb_simple_error_msg("no dhcp clients found");
        return 0;
 }
 # elif ENABLE_UDHCPC
@@ -707,7 +707,7 @@ static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
        }
 
        if (!result)
-               bb_error_msg("warning: no dhcp clients found and stopped");
+               bb_simple_error_msg("warning: no dhcp clients found and stopped");
 
        /* Sleep a bit, otherwise static_down tries to bring down interface too soon,
           and it may come back up because udhcpc is still shutting down */
index da65511744617f1923128b28444b2edbd830d5d0..3cd2b11f033f1f5f6ba9202a60582b5b3b509b9d 100644 (file)
@@ -504,7 +504,7 @@ static void register_rpc(servtab_t *sep)
 
        if (bb_getsockname(sep->se_fd, (struct sockaddr *) &ir_sin, sizeof(ir_sin)) < 0) {
 //TODO: verify that such failure is even possible in Linux kernel
-               bb_perror_msg("getsockname");
+               bb_simple_perror_msg("getsockname");
                return;
        }
 
@@ -544,7 +544,7 @@ static void bump_nofile(void)
        }
 
        if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
-               bb_perror_msg("setrlimit");
+               bb_simple_perror_msg("setrlimit");
                return;
        }
 
@@ -599,7 +599,7 @@ static void prepare_socket_fd(servtab_t *sep)
 
        fd = socket(sep->se_family, sep->se_socktype, 0);
        if (fd < 0) {
-               bb_perror_msg("socket");
+               bb_simple_perror_msg("socket");
                return;
        }
        setsockopt_reuseaddr(fd);
@@ -815,7 +815,7 @@ static NOINLINE servtab_t *parse_one_line(void)
                        n = bb_strtou(p, &p, 10);
                        if (n > INT_MAX) {
  bad_ver_spec:
-                               bb_error_msg("bad rpc version");
+                               bb_simple_error_msg("bad rpc version");
                                goto parse_err;
                        }
                        sep->se_rpcver_lo = sep->se_rpcver_hi = n;
@@ -829,7 +829,7 @@ static NOINLINE servtab_t *parse_one_line(void)
                        if (*p != '\0')
                                goto bad_ver_spec;
 #else
-                       bb_error_msg("no support for rpc services");
+                       bb_simple_error_msg("no support for rpc services");
                        goto parse_err;
 #endif
                }
@@ -1235,7 +1235,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
        if (argv[0])
                config_filename = argv[0];
        if (config_filename == NULL)
-               bb_error_msg_and_die("non-root must specify config file");
+               bb_simple_error_msg_and_die("non-root must specify config file");
        if (!(opt & 2))
                bb_daemonize_or_rexec(0, argv - optind);
        else
@@ -1304,7 +1304,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
                ready_fd_cnt = select(maxsock + 1, &readable, NULL, NULL, NULL);
                if (ready_fd_cnt < 0) {
                        if (errno != EINTR) {
-                               bb_perror_msg("select");
+                               bb_simple_perror_msg("select");
                                sleep(1);
                        }
                        continue;
@@ -1405,7 +1405,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
                                        pid = vfork();
 
                                if (pid < 0) { /* fork error */
-                                       bb_perror_msg("vfork"+1);
+                                       bb_simple_perror_msg("vfork"+1);
                                        sleep(1);
                                        restore_sigmask(&omask);
                                        maybe_close(new_udp_fd);
@@ -1488,7 +1488,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
                        }
                        if (real_uid != 0 && real_uid != pwd->pw_uid) {
                                /* a user running private inetd */
-                               bb_error_msg("non-root must run services as himself");
+                               bb_simple_error_msg("non-root must run services as himself");
                                goto do_exit1;
                        }
                        if (pwd->pw_uid != real_uid) {
@@ -1502,7 +1502,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
                        }
                        if (rlim_ofile.rlim_cur != rlim_ofile_cur)
                                if (setrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0)
-                                       bb_perror_msg("setrlimit");
+                                       bb_simple_perror_msg("setrlimit");
 
                        /* closelog(); - WRONG. we are after vfork,
                         * this may confuse syslog() internal state.
index 67f768836ec66ad71ca05a6519e7c93093760bc0..09b14687244f1ddc19646ef2d6d7c35ee229698c 100644 (file)
@@ -183,7 +183,7 @@ int ipcalc_main(int argc UNUSED_PARAM, char **argv)
 
        if (argv[1]) {
                if (ENABLE_FEATURE_IPCALC_FANCY && have_netmask) {
-                       bb_error_msg_and_die("use prefix or netmask, not both");
+                       bb_simple_error_msg_and_die("use prefix or netmask, not both");
                }
                if (inet_aton(argv[1], &s_netmask) == 0) {
                        bb_error_msg_and_die("bad netmask: %s", argv[1]);
index 97f5c6d4e06942fa3435662a13e957349e149e0e..0e3f10f9a01e077f372325d8a5f939199190eebc 100644 (file)
@@ -185,7 +185,7 @@ static void handle_accept(isrv_state_t *state, int fd)
                /* Most probably someone gave us wrong fd type
                 * (for example, non-socket). Don't want
                 * to loop forever. */
-               bb_perror_msg_and_die("accept");
+               bb_simple_perror_msg_and_die("accept");
        }
 
        DPRINTF("new_peer(%d)", newfd);
@@ -311,7 +311,7 @@ void isrv_run(
 
                if (n < 0) {
                        if (errno != EINTR)
-                               bb_perror_msg("select");
+                               bb_simple_perror_msg("select");
                        continue;
                }
 
index 7b7e0154b17572dbf846ed83d101b89816fdca38..86cf3beea513c18f6dd85522a86c6a460676c111 100644 (file)
@@ -119,7 +119,7 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n)
        //memset(tb, 0, sizeof(tb)); - parse_rtattr does this
        parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
        if (tb[IFLA_IFNAME] == NULL) {
-               bb_error_msg("nil ifname");
+               bb_simple_error_msg("nil ifname");
                return -1;
        }
        if (G_filter.label
@@ -205,7 +205,7 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n)
 static int flush_update(void)
 {
        if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) {
-               bb_perror_msg("can't send flush request");
+               bb_simple_perror_msg("can't send flush request");
                return -1;
        }
        G_filter.flushp = 0;
@@ -439,7 +439,7 @@ int FAST_FUNC ipaddr_list_or_flush(char **argv, int flush)
                        bb_error_msg_and_die(bb_msg_requires_arg, "flush");
                }
                if (G_filter.family == AF_PACKET) {
-                       bb_error_msg_and_die("can't flush link addresses");
+                       bb_simple_error_msg_and_die("can't flush link addresses");
                }
        }
 
@@ -700,7 +700,7 @@ static int ipaddr_modify(int cmd, int flags, char **argv)
 
        if (!d) {
                /* There was no "dev IFACE", but we need that */
-               bb_error_msg_and_die("need \"dev IFACE\"");
+               bb_simple_error_msg_and_die("need \"dev IFACE\"");
        }
        if (l && !is_prefixed_with(l, d)) {
                bb_error_msg_and_die("\"dev\" (%s) must match \"label\" (%s)", d, l);
@@ -717,7 +717,7 @@ static int ipaddr_modify(int cmd, int flags, char **argv)
                inet_prefix brd;
                int i;
                if (req.ifa.ifa_family != AF_INET) {
-                       bb_error_msg_and_die("broadcast can be set only for IPv4 addresses");
+                       bb_simple_error_msg_and_die("broadcast can be set only for IPv4 addresses");
                }
                brd = peer;
                if (brd.bitlen <= 30) {
index 984dd4bdd5b27923f23739b57e02a4ec96f70067..b9b4f4b310f2219b82f53701d8359abf1fd1f8b8 100644 (file)
@@ -49,7 +49,7 @@ typedef struct filter_t filter_t;
 static int flush_update(void)
 {
        if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) {
-               bb_perror_msg("can't send flush request");
+               bb_simple_perror_msg("can't send flush request");
                return -1;
        }
        G_filter.flushp = 0;
@@ -305,7 +305,7 @@ static int FAST_FUNC ipneigh_list_or_flush(char **argv, int flush)
                        xrtnl_wilddump_request(&rth, G_filter.family, RTM_GETNEIGH);
                        G_filter.flushed = 0;
                        if (xrtnl_dump_filter(&rth, print_neigh, NULL) < 0) {
-                               bb_perror_msg_and_die("flush terminated");
+                               bb_simple_perror_msg_and_die("flush terminated");
                        }
                        if (G_filter.flushed == 0) {
                                if (round == 0)
@@ -325,11 +325,11 @@ static int FAST_FUNC ipneigh_list_or_flush(char **argv, int flush)
        ndm.ndm_family = G_filter.family;
 
        if (rtnl_dump_request(&rth, RTM_GETNEIGH, &ndm, sizeof(struct ndmsg)) < 0) {
-               bb_perror_msg_and_die("can't send dump request");
+               bb_simple_perror_msg_and_die("can't send dump request");
        }
 
        if (xrtnl_dump_filter(&rth, print_neigh, NULL) < 0) {
-               bb_error_msg_and_die("dump terminated");
+               bb_simple_error_msg_and_die("dump terminated");
        }
 
        return 0;
index b11078ed59ddf766229d3658702c778e30c60060..5a972f8b2b782692a2e494b3a7e1696cdb525fde 100644 (file)
@@ -57,7 +57,7 @@ typedef struct filter_t filter_t;
 static int flush_update(void)
 {
        if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) {
-               bb_perror_msg("can't send flush request");
+               bb_simple_perror_msg("can't send flush request");
                return -1;
        }
        G_filter.flushp = 0;
@@ -756,7 +756,7 @@ static void iproute_flush_cache(void)
        }
 
        if (write(flush_fd, "-1", 2) < 2) {
-               bb_perror_msg("can't flush routing cache");
+               bb_simple_perror_msg("can't flush routing cache");
                return;
        }
        close(flush_fd);
@@ -948,7 +948,7 @@ static int iproute_list_or_flush(char **argv, int flush)
        if (G_filter.tb != -1) {
                xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE);
        } else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) {
-               bb_perror_msg_and_die("can't send dump request");
+               bb_simple_perror_msg_and_die("can't send dump request");
        }
        xrtnl_dump_filter(&rth, print_route, NULL);
 
@@ -1041,7 +1041,7 @@ static int iproute_get(char **argv)
        }
 
        if (req.r.rtm_dst_len == 0) {
-               bb_error_msg_and_die("need at least destination address");
+               bb_simple_error_msg_and_die("need at least destination address");
        }
 
        xrtnl_open(&rth);
@@ -1077,7 +1077,7 @@ static int iproute_get(char **argv)
                print_route(NULL, &req.n, NULL);
 
                if (req.n.nlmsg_type != RTM_NEWROUTE) {
-                       bb_error_msg_and_die("not a route?");
+                       bb_simple_error_msg_and_die("not a route?");
                }
                len -= NLMSG_LENGTH(sizeof(*r));
                if (len < 0) {
@@ -1091,7 +1091,7 @@ static int iproute_get(char **argv)
                        tb[RTA_PREFSRC]->rta_type = RTA_SRC;
                        r->rtm_src_len = 8*RTA_PAYLOAD(tb[RTA_PREFSRC]);
                } else if (!tb[RTA_SRC]) {
-                       bb_error_msg_and_die("can't connect the route");
+                       bb_simple_error_msg_and_die("can't connect the route");
                }
                if (!odev && tb[RTA_OIF]) {
                        tb[RTA_OIF]->rta_type = 0;
index 4002feb78b20437fe519ba937afffda1b33a4afa..c9fa632f3254d80eecd853879449d568a17cc1b0 100644 (file)
@@ -338,7 +338,7 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p)
 
        if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) {
                if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {
-                       bb_error_msg_and_die("keys are not allowed with ipip and sit");
+                       bb_simple_error_msg_and_die("keys are not allowed with ipip and sit");
                }
        }
 
@@ -355,7 +355,7 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p)
                p->o_flags |= GRE_KEY;
        }
        if (IN_MULTICAST(ntohl(p->iph.daddr)) && !p->iph.saddr) {
-               bb_error_msg_and_die("broadcast tunnel requires a source address");
+               bb_simple_error_msg_and_die("broadcast tunnel requires a source address");
        }
 }
 
@@ -367,7 +367,7 @@ static int do_add(int cmd, char **argv)
        parse_args(argv, cmd, &p);
 
        if (p.iph.ttl && p.iph.frag_off == 0) {
-               bb_error_msg_and_die("ttl != 0 and noptmudisc are incompatible");
+               bb_simple_error_msg_and_die("ttl != 0 and noptmudisc are incompatible");
        }
 
        switch (p.iph.protocol) {
@@ -378,7 +378,7 @@ static int do_add(int cmd, char **argv)
        case IPPROTO_IPV6:
                return do_add_ioctl(cmd, "sit0", &p);
        default:
-               bb_error_msg_and_die("can't determine tunnel mode (ipip, gre or sit)");
+               bb_simple_error_msg_and_die("can't determine tunnel mode (ipip, gre or sit)");
        }
 }
 
@@ -485,7 +485,7 @@ static void do_tunnels_list(struct ip_tunnel_parm *p)
                if (ptr == NULL ||
                    (*ptr++ = 0, sscanf(buf, "%s", name) != 1)
                ) {
-                       bb_error_msg("wrong format of /proc/net/dev");
+                       bb_simple_error_msg("wrong format of /proc/net/dev");
                        return;
                }
                if (sscanf(ptr, "%lu%lu%lu%lu%lu%lu%lu%*d%lu%lu%lu%lu%lu%lu%lu",
index b0d4166ac47906c218640f09bfa22ccc77cff02a..7e3473a1cc55a66beef2303aee6bb6dcc172d9db 100644 (file)
@@ -79,7 +79,7 @@ int FAST_FUNC rtnl_send_check(struct rtnl_handle *rth, const void *buf, int len)
                if (h->nlmsg_type == NLMSG_ERROR) {
                        struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
                        if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr)))
-                               bb_error_msg("ERROR truncated");
+                               bb_simple_error_msg("ERROR truncated");
                        else
                                errno = -err->error;
                        return -1;
@@ -149,11 +149,11 @@ static int rtnl_dump_filter(struct rtnl_handle *rth,
                if (status < 0) {
                        if (errno == EINTR)
                                continue;
-                       bb_perror_msg("OVERRUN");
+                       bb_simple_perror_msg("OVERRUN");
                        continue;
                }
                if (status == 0) {
-                       bb_error_msg("EOF on netlink");
+                       bb_simple_error_msg("EOF on netlink");
                        goto ret;
                }
                if (msg.msg_namelen != sizeof(nladdr)) {
@@ -184,10 +184,10 @@ static int rtnl_dump_filter(struct rtnl_handle *rth,
                        if (h->nlmsg_type == NLMSG_ERROR) {
                                struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h);
                                if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
-                                       bb_error_msg("ERROR truncated");
+                                       bb_simple_error_msg("ERROR truncated");
                                } else {
                                        errno = -l_err->error;
-                                       bb_perror_msg("RTNETLINK answers");
+                                       bb_simple_perror_msg("RTNETLINK answers");
                                }
                                goto ret;
                        }
@@ -201,7 +201,7 @@ static int rtnl_dump_filter(struct rtnl_handle *rth,
                        h = NLMSG_NEXT(h, status);
                }
                if (msg.msg_flags & MSG_TRUNC) {
-                       bb_error_msg("message truncated");
+                       bb_simple_error_msg("message truncated");
                        continue;
                }
                if (status) {
@@ -221,7 +221,7 @@ int FAST_FUNC xrtnl_dump_filter(struct rtnl_handle *rth,
 {
        int ret = rtnl_dump_filter(rth, filter, arg1/*, NULL, NULL*/);
        if (ret < 0)
-               bb_error_msg_and_die("dump terminated");
+               bb_simple_error_msg_and_die("dump terminated");
        return ret;
 }
 
@@ -266,7 +266,7 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
        status = sendmsg(rtnl->fd, &msg, 0);
 
        if (status < 0) {
-               bb_perror_msg("can't talk to rtnetlink");
+               bb_simple_perror_msg("can't talk to rtnetlink");
                goto ret;
        }
 
@@ -280,11 +280,11 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
                        if (errno == EINTR) {
                                continue;
                        }
-                       bb_perror_msg("OVERRUN");
+                       bb_simple_perror_msg("OVERRUN");
                        continue;
                }
                if (status == 0) {
-                       bb_error_msg("EOF on netlink");
+                       bb_simple_error_msg("EOF on netlink");
                        goto ret;
                }
                if (msg.msg_namelen != sizeof(nladdr)) {
@@ -297,7 +297,7 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
 
                        if (l < 0 || len > status) {
                                if (msg.msg_flags & MSG_TRUNC) {
-                                       bb_error_msg("truncated message");
+                                       bb_simple_error_msg("truncated message");
                                        goto ret;
                                }
                                bb_error_msg_and_die("malformed message: len=%d!", len);
@@ -320,7 +320,7 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
                        if (h->nlmsg_type == NLMSG_ERROR) {
                                struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
                                if (l < (int)sizeof(struct nlmsgerr)) {
-                                       bb_error_msg("ERROR truncated");
+                                       bb_simple_error_msg("ERROR truncated");
                                } else {
                                        errno = - err->error;
                                        if (errno == 0) {
@@ -329,7 +329,7 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
                                                }
                                                goto ret_0;
                                        }
-                                       bb_perror_msg("RTNETLINK answers");
+                                       bb_simple_perror_msg("RTNETLINK answers");
                                }
                                goto ret;
                        }
@@ -338,13 +338,13 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
                                goto ret_0;
                        }
 
-                       bb_error_msg("unexpected reply!");
+                       bb_simple_error_msg("unexpected reply!");
 
                        status -= NLMSG_ALIGN(len);
                        h = (struct nlmsghdr*)((char*)h + NLMSG_ALIGN(len));
                }
                if (msg.msg_flags & MSG_TRUNC) {
-                       bb_error_msg("message truncated");
+                       bb_simple_error_msg("message truncated");
                        continue;
                }
                if (status) {
index bf053a54bf114bba1fea830043b4a9274a080cc1..4ce2303569bdc9c72f1fada68f781810c4bd05ac 100644 (file)
@@ -230,7 +230,7 @@ uint32_t FAST_FUNC get_addr32(char *name)
 char** FAST_FUNC next_arg(char **argv)
 {
        if (!*++argv)
-               bb_error_msg_and_die("command line is not complete, try \"help\"");
+               bb_simple_error_msg_and_die("command line is not complete, try \"help\"");
        return argv;
 }
 
index 0dc8d0c43783d9e7508139d4535656ff300c6025..3db3b46f9cb38424f38391e2ded6d0b813848549 100644 (file)
@@ -179,7 +179,7 @@ int nbdclient_main(int argc, char **argv)
                if (memcmp(&nbd_header.magic1, "NBDMAGIC",
                                sizeof(nbd_header.magic1)) != 0
                ) {
-                       bb_error_msg_and_die("login failed");
+                       bb_simple_error_msg_and_die("login failed");
                }
                if (memcmp(&nbd_header.magic2,
                                "\x00\x00\x42\x02\x81\x86\x12\x53",
@@ -189,7 +189,7 @@ int nbdclient_main(int argc, char **argv)
                } else if (memcmp(&nbd_header.magic2, "IHAVEOPT", 8) == 0) {
                        proto_new = 1;
                } else {
-                       bb_error_msg_and_die("login failed");
+                       bb_simple_error_msg_and_die("login failed");
                }
 
                if (!proto_new) {
@@ -240,17 +240,17 @@ int nbdclient_main(int argc, char **argv)
                }
 
                if (ioctl(nbd, BLKROSET, &ro) < 0) {
-                       bb_perror_msg_and_die("BLKROSET");
+                       bb_simple_perror_msg_and_die("BLKROSET");
                }
 
                if (timeout) {
                        if (ioctl(nbd, NBD_SET_TIMEOUT, (unsigned long) timeout)) {
-                               bb_perror_msg_and_die("NBD_SET_TIMEOUT");
+                               bb_simple_perror_msg_and_die("NBD_SET_TIMEOUT");
                        }
                }
 
                if (ioctl(nbd, NBD_SET_SOCK, sock)) {
-                       bb_perror_msg_and_die("NBD_SET_SOCK");
+                       bb_simple_perror_msg_and_die("NBD_SET_SOCK");
                }
 
                //if (swap) mlockall(MCL_CURRENT|MCL_FUTURE);
index b208f46c638f78f04e6d27592398d00766b16a2a..705b7356a2d7d72029564e252752b2d88974dc9d 100644 (file)
 
 static void timeout(int signum UNUSED_PARAM)
 {
-       bb_error_msg_and_die("timed out");
+       bb_simple_error_msg_and_die("timed out");
 }
 
 int nc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -211,7 +211,7 @@ int nc_main(int argc, char **argv)
  accept_again:
                        cfd = accept(sfd, NULL, 0);
                        if (cfd < 0)
-                               bb_perror_msg_and_die("accept");
+                               bb_simple_perror_msg_and_die("accept");
                        if (!execparam)
                                close(sfd);
                } else {
@@ -260,7 +260,7 @@ int nc_main(int argc, char **argv)
                int nread;
 
                if (safe_poll(pfds, 2, -1) < 0)
-                       bb_perror_msg_and_die("poll");
+                       bb_simple_perror_msg_and_die("poll");
 
                fdidx = 0;
                while (1) {
index 42c84de45e75a1c29f83e392776a6fc97149f592..034e03d21f6c67c50110716af4d52eb3e9637f73 100644 (file)
@@ -198,8 +198,8 @@ enum {
 #define Debug(...) do { } while (0)
 #endif
 
-#define holler_error(...)  do { if (o_verbose) bb_error_msg(__VA_ARGS__); } while (0)
-#define holler_perror(...) do { if (o_verbose) bb_perror_msg(__VA_ARGS__); } while (0)
+#define holler_error(msg)  do { if (o_verbose) bb_simple_error_msg(msg); } while (0)
+#define holler_perror(msg) do { if (o_verbose) bb_simple_perror_msg(msg); } while (0)
 
 /* catch: no-brainer interrupt handler */
 static void catch(int sig)
@@ -361,10 +361,10 @@ static void dolisten(int is_persistent, char **proggie)
                        rr = recv_from_to(netfd, NULL, 0, MSG_PEEK, /*was bigbuf_net, BIGSIZ*/
                                &remend.u.sa, &ouraddr->u.sa, ouraddr->len);
                        if (rr < 0)
-                               bb_perror_msg_and_die("recvfrom");
+                               bb_simple_perror_msg_and_die("recvfrom");
                        unarm();
                } else
-                       bb_error_msg_and_die("timeout");
+                       bb_simple_error_msg_and_die("timeout");
 /* Now we learned *to which IP* peer has connected, and we want to anchor
 our socket on it, so that our outbound packets will have correct local IP.
 Unfortunately, bind() on already bound socket will fail now (EINVAL):
@@ -382,7 +382,7 @@ create new one, and bind() it. TODO */
                        remend.len = LSA_SIZEOF_SA;
                        rr = accept(netfd, &remend.u.sa, &remend.len);
                        if (rr < 0)
-                               bb_perror_msg_and_die("accept");
+                               bb_simple_perror_msg_and_die("accept");
                        if (themaddr) {
                                int sv_port, port, r;
 
@@ -409,7 +409,7 @@ create new one, and bind() it. TODO */
                        }
                        unarm();
                } else
-                       bb_error_msg_and_die("timeout");
+                       bb_simple_error_msg_and_die("timeout");
 
                if (is_persistent && proggie) {
                        /* -l -k -e PROG */
@@ -494,7 +494,7 @@ static int udptest(void)
 
        rr = write(netfd, bigbuf_in, 1);
        if (rr != 1)
-               bb_perror_msg("udptest first write");
+               bb_simple_perror_msg("udptest first write");
 
        if (o_wait)
                sleep(o_wait); // can be interrupted! while (t) nanosleep(&t)?
@@ -644,7 +644,7 @@ static int readwrite(void)
                        if (rr <= 0) {
                                if (rr < 0 && o_verbose > 1) {
                                        /* nc 1.10 doesn't do this */
-                                       bb_perror_msg("net read");
+                                       bb_simple_perror_msg("net read");
                                }
                                pfds[1].fd = -1;                   /* don't poll for netfd anymore */
                                fds_open--;
@@ -869,7 +869,7 @@ int nc_main(int argc UNUSED_PARAM, char **argv)
                /* apparently UDP can listen ON "port 0",
                 but that's not useful */
                if (!o_lport)
-                       bb_error_msg_and_die("UDP listen needs nonzero -p port");
+                       bb_simple_error_msg_and_die("UDP listen needs nonzero -p port");
        }
 #endif
 
index f6bcd44ba1656dbfbc961f568a842b80d28472a9..29b891cdc1a89b1045c67951a8586c624b2833db 100644 (file)
@@ -343,9 +343,9 @@ static void prg_cache_load(void)
                return;
 
        if (prg_cache_loaded == 1)
-               bb_error_msg("can't scan /proc - are you root?");
+               bb_simple_error_msg("can't scan /proc - are you root?");
        else
-               bb_error_msg("showing only processes with your user ID");
+               bb_simple_error_msg("showing only processes with your user ID");
 }
 
 #else
index 24e09d4f0bfc515d2aba02b3a5c5bca16f736a5b..8adde14b8f4786d2e06fefde4ae9981c6f31125e 100644 (file)
@@ -549,7 +549,7 @@ static int send_queries(struct ns *ns)
 
                recvlen = read(pfd.fd, reply, sizeof(reply));
                if (recvlen < 0) {
-                       bb_perror_msg("read");
+                       bb_simple_perror_msg("read");
  next:
                        tcur = monotonic_ms();
                        continue;
index d55b070c5b07c39f49c814207a1c5a04939086e5..2700cf51540d03bf60ebfaf057c97756ba67f03d 100644 (file)
@@ -905,7 +905,7 @@ do_sendto(int fd,
                ret = send_to_from(fd, msg, len, MSG_DONTWAIT, to, from, addrlen);
        }
        if (ret != len) {
-               bb_perror_msg("send failed");
+               bb_simple_perror_msg("send failed");
                return -1;
        }
        return 0;
@@ -1121,7 +1121,7 @@ step_time(double offset)
        dtime = tvc.tv_sec + (1.0e-6 * tvc.tv_usec) + offset;
        d_to_tv(dtime, &tvn);
        if (settimeofday(&tvn, NULL) == -1)
-               bb_perror_msg_and_die("settimeofday");
+               bb_simple_perror_msg_and_die("settimeofday");
 
        VERB2 {
                tval = tvc.tv_sec;
@@ -1494,7 +1494,7 @@ select_and_cluster(void)
                /* Starting from 1 is ok here */
                for (i = 1; i < num_survivors; i++) {
                        if (G.last_update_peer == survivor[i].p) {
-                               VERB5 bb_error_msg("keeping old synced peer");
+                               VERB5 bb_simple_error_msg("keeping old synced peer");
                                p = G.last_update_peer;
                                goto keep_old;
                        }
@@ -1702,7 +1702,7 @@ update_local_clock(peer_t *p)
 #else
                        set_new_values(STATE_SYNC, offset, recv_time);
 #endif
-                       VERB4 bb_error_msg("transitioning to FREQ, datapoint ignored");
+                       VERB4 bb_simple_error_msg("transitioning to FREQ, datapoint ignored");
                        return 0; /* "leave poll interval as is" */
 
 #if 0 /* this is dead code for now */
@@ -1796,7 +1796,7 @@ update_local_clock(peer_t *p)
        VERB4 {
                memset(&tmx, 0, sizeof(tmx));
                if (adjtimex(&tmx) < 0)
-                       bb_perror_msg_and_die("adjtimex");
+                       bb_simple_perror_msg_and_die("adjtimex");
                bb_error_msg("p adjtimex freq:%ld offset:%+ld status:0x%x tc:%ld",
                                tmx.freq, tmx.offset, tmx.status, tmx.constant);
        }
@@ -1906,7 +1906,7 @@ update_local_clock(peer_t *p)
        //tmx.maxerror = (uint32_t)((sys_rootdelay / 2 + sys_rootdisp) * 1e6);
        rc = adjtimex(&tmx);
        if (rc < 0)
-               bb_perror_msg_and_die("adjtimex");
+               bb_simple_perror_msg_and_die("adjtimex");
        /* NB: here kernel returns constant == G.poll_exp, not == G.poll_exp - 4.
         * Not sure why. Perhaps it is normal.
         */
@@ -2248,7 +2248,7 @@ recv_and_process_client_pkt(void /*int fd*/)
                if (size < 0) {
                        if (errno == EAGAIN)
                                goto bail;
-                       bb_perror_msg_and_die("recv");
+                       bb_simple_perror_msg_and_die("recv");
                }
                addr = xmalloc_sockaddr2dotted_noport(from);
                bb_error_msg("malformed packet received from %s: size %u", addr, (int)size);
@@ -2415,7 +2415,7 @@ static NOINLINE void ntp_init(char **argv)
        srand(getpid());
 
        if (getuid())
-               bb_error_msg_and_die(bb_msg_you_must_be_root);
+               bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
 
        /* Set some globals */
        G.discipline_jitter = G_precision_sec;
@@ -2491,7 +2491,7 @@ static NOINLINE void ntp_init(char **argv)
                                /* supports 'sha' and 'sha1' formats */
                                hash_type = HASH_SHA1;
                        else
-                               bb_error_msg_and_die("only MD5 and SHA1 keys supported");
+                               bb_simple_error_msg_and_die("only MD5 and SHA1 keys supported");
 /* man ntp.keys:
  *  MD5    The key is 1 to 16 printable characters terminated by an EOL,
  *         whitespace, or a # (which is the "start of comment" character).
@@ -2674,7 +2674,7 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
                                if (p->p_fd == -1) {
                                        /* Time to send new req */
                                        if (--cnt == 0) {
-                                               VERB4 bb_error_msg("disabling burst mode");
+                                               VERB4 bb_simple_error_msg("disabling burst mode");
                                                G.polladj_count = 0;
                                                G.poll_exp = MINPOLL;
                                        }
index b534c74c7346f009f16029799c070aa6e1a195d7..a47342fee85dfdd1369034cc7439b863a940eee2 100644 (file)
@@ -184,8 +184,8 @@ create_icmp_socket(void)
                sock = socket(AF_INET, SOCK_RAW, 1); /* 1 == ICMP */
        if (sock < 0) {
                if (errno == EPERM)
-                       bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
-               bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
+                       bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
+               bb_simple_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
        }
 
        xmove_fd(sock, pingsock);
@@ -235,7 +235,7 @@ static void ping4(len_and_sockaddr *lsa)
 #endif
                if (c < 0) {
                        if (errno != EINTR)
-                               bb_perror_msg("recvfrom");
+                               bb_simple_perror_msg("recvfrom");
                        continue;
                }
                if (c >= 76) {                  /* ip + icmp */
@@ -280,7 +280,7 @@ static void ping6(len_and_sockaddr *lsa)
 #endif
                if (c < 0) {
                        if (errno != EINTR)
-                               bb_perror_msg("recvfrom");
+                               bb_simple_perror_msg("recvfrom");
                        continue;
                }
                if (c >= ICMP_MINLEN) { /* icmp6_hdr */
@@ -482,7 +482,7 @@ static void sendping_tail(void (*sp)(int), int size_pkt)
         * it doesn't matter */
        sz = xsendto(pingsock, G.snd_packet, size_pkt, &pingaddr.sa, sizeof(pingaddr));
        if (sz != size_pkt)
-               bb_error_msg_and_die(bb_msg_write_error);
+               bb_simple_error_msg_and_die(bb_msg_write_error);
 
        if (pingcount == 0 || G.ntransmitted < pingcount) {
                /* Didn't send all pings yet - schedule next in -i SEC interval */
@@ -723,7 +723,7 @@ static void ping4(len_and_sockaddr *lsa)
        if (source_lsa) {
                if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF,
                                &source_lsa->u.sa, source_lsa->len))
-                       bb_error_msg_and_die("can't set multicast source interface");
+                       bb_simple_error_msg_and_die("can't set multicast source interface");
                xbind(pingsock, &source_lsa->u.sa, source_lsa->len);
        }
 
@@ -757,7 +757,7 @@ static void ping4(len_and_sockaddr *lsa)
                                (struct sockaddr *) &from, &fromlen);
                if (c < 0) {
                        if (errno != EINTR)
-                               bb_perror_msg("recvfrom");
+                               bb_simple_perror_msg("recvfrom");
                        continue;
                }
                c = unpack4(G.rcv_packet, c, &from);
@@ -838,7 +838,7 @@ static void ping6(len_and_sockaddr *lsa)
                c = recvmsg(pingsock, &msg, 0);
                if (c < 0) {
                        if (errno != EINTR)
-                               bb_perror_msg("recvfrom");
+                               bb_simple_perror_msg("recvfrom");
                        continue;
                }
                for (mp = CMSG_FIRSTHDR(&msg); mp; mp = CMSG_NXTHDR(&msg, mp)) {
index ac1d94c28fe0b4dc52d0d32477fdd4cf550725ff..a5d8d7cb9bea7a09e0d426b0881fff1df9140f13 100644 (file)
@@ -336,7 +336,7 @@ static NOINLINE void INET_setroute(int action, char **args)
                }
                mask = ((struct sockaddr_in *) &rt->rt_dst)->sin_addr.s_addr;
                if (mask & ~(uint32_t)mask_in_addr(*rt)) {
-                       bb_error_msg_and_die("netmask and route address conflict");
+                       bb_simple_error_msg_and_die("netmask and route address conflict");
                }
        }
 
@@ -532,7 +532,7 @@ void FAST_FUNC bb_displayroutes(int noresolve, int netstatfmt)
                        if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */
                                break;
                        }
-                       bb_perror_msg_and_die(bb_msg_read_error);
+                       bb_simple_perror_msg_and_die(bb_msg_read_error);
                }
 
                if (!(flgs & RTF_UP)) { /* Skip interfaces that are down. */
@@ -598,7 +598,7 @@ static void INET6_displayroutes(void)
                                break;
                        }
  ERROR:
-                       bb_perror_msg_and_die(bb_msg_read_error);
+                       bb_simple_perror_msg_and_die(bb_msg_read_error);
                }
 
                /* Do the addr6x shift-and-insert changes to ':'-delimit addresses.
index c6feca24851b65589ea62e16af9ba87c3e5b3d0e..659822a914f27d50b87b4b46a0aca8d27988f818 100644 (file)
@@ -56,7 +56,7 @@ static int tcsetattr_serial_or_warn(struct termios *state)
 
        ret = tcsetattr(serial_fd, TCSANOW, state);
        if (ret != 0) {
-               bb_perror_msg("tcsetattr");
+               bb_simple_perror_msg("tcsetattr");
                return 1; /* used as exitcode */
        }
        return ret; /* 0 */
@@ -159,7 +159,7 @@ int slattach_main(int argc UNUSED_PARAM, char **argv)
 
        /* Save current tty state */
        if (tcgetattr(serial_fd, &G.saved_state) != 0)
-               bb_perror_msg_and_die("tcgetattr");
+               bb_simple_perror_msg_and_die("tcgetattr");
        /* Save line discipline */
        xioctl(serial_fd, TIOCGETD, &G.saved_disc);
 
index a0af649815fdda9b54287772f916c91c0a325cbb..8c4afabf61c89cd053c84a9940f3d8196cec70f9 100644 (file)
@@ -325,7 +325,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
        client = 0;
        if ((getuid() == 0) && !(opts & OPT_u)) {
                xfunc_error_retval = 100;
-               bb_error_msg_and_die(bb_msg_you_must_be_root);
+               bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
        }
        if (opts & OPT_u)
                if (!uidgid_get(&sslugid, ssluser, 1)) {
@@ -419,7 +419,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
        sig_block(SIGCHLD);
        if (conn < 0) {
                if (errno != EINTR)
-                       bb_perror_msg(tcp ? "accept" : "recv");
+                       bb_simple_perror_msg(tcp ? "accept" : "recv");
                goto again2;
        }
        xmove_fd(tcp ? conn : sock, 0);
@@ -484,7 +484,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
 
        pid = vfork();
        if (pid == -1) {
-               bb_perror_msg("vfork");
+               bb_simple_perror_msg("vfork");
                goto again;
        }
 
index 6abecbde2292c29748e9088e66d4421ff21dff40..29f805de722cb0eb41fe02dfe4181445c4f08e6b 100644 (file)
@@ -495,7 +495,7 @@ make_new_session(
                free(ts);
                close(fd);
                /* sock will be closed by caller */
-               bb_perror_msg("vfork");
+               bb_simple_perror_msg("vfork");
                return NULL;
        }
        if (pid > 0) {
index d551c861f05fe926e32e37a6a286b9c1c07d39cd..04bfe844f86add4492777b68533f0587eb44f113 100644 (file)
@@ -453,7 +453,7 @@ static int tftp_protocol(
                /* fill in packet if the filename fits into xbuf */
                len = strlen(remote_file) + 1;
                if (2 + len + sizeof("octet") >= io_bufsize) {
-                       bb_error_msg("remote filename is too long");
+                       bb_simple_error_msg("remote filename is too long");
                        goto ret;
                }
                strcpy(cp, remote_file);
@@ -468,7 +468,7 @@ static int tftp_protocol(
 
                /* Need to add option to pkt */
                if ((&xbuf[io_bufsize - 1] - cp) < sizeof("blksize NNNNN tsize ") + sizeof(off_t)*3) {
-                       bb_error_msg("remote filename is too long");
+                       bb_simple_error_msg("remote filename is too long");
                        goto ret;
                }
                expect_OACK = 1;
@@ -569,7 +569,7 @@ static int tftp_protocol(
                        retries--;
                        if (retries == 0) {
                                tftp_progress_done();
-                               bb_error_msg("timeout");
+                               bb_simple_error_msg("timeout");
                                goto ret; /* no err packet sent */
                        }
 
@@ -674,7 +674,7 @@ static int tftp_protocol(
                         * must be ignored by the client and server
                         * as if it were never requested." */
                        if (blksize != TFTP_BLKSIZE_DEFAULT)
-                               bb_error_msg("falling back to blocksize "TFTP_BLKSIZE_DEFAULT_STR);
+                               bb_simple_error_msg("falling back to blocksize "TFTP_BLKSIZE_DEFAULT_STR);
                        blksize = TFTP_BLKSIZE_DEFAULT;
                        io_bufsize = TFTP_BLKSIZE_DEFAULT + 4;
                }
@@ -739,7 +739,7 @@ static int tftp_protocol(
        strcpy(G_error_pkt_str, bb_msg_read_error);
  send_err_pkt:
        if (G_error_pkt_str[0])
-               bb_error_msg("%s", G_error_pkt_str);
+               bb_simple_error_msg(G_error_pkt_str);
        G.error_pkt[1] = TFTP_ERROR;
        xsendto(socket_fd, G.error_pkt, 4 + 1 + strlen(G_error_pkt_str),
                        &peer_lsa->u.sa, peer_lsa->len);
index db7be07f3a8390a0c521fd7d7e44fe738297350a..854937302ddc41e11784fd440d533eb22c62580c 100644 (file)
@@ -446,7 +446,7 @@ static void hmac_begin(hmac_precomputed_t *pre, uint8_t *key, unsigned key_size,
        // than INSIZE bytes will first hash the key using H and then use the
        // resultant OUTSIZE byte string as the actual key to HMAC."
        if (key_size > SHA_INSIZE) {
-               bb_error_msg_and_die("HMAC key>64"); //does not happen (yet?)
+               bb_simple_error_msg_and_die("HMAC key>64"); //does not happen (yet?)
 //             md5sha_ctx_t ctx;
 //             begin(&ctx);
 //             md5sha_hash(&ctx, key, key_size);
@@ -1132,7 +1132,7 @@ static int tls_xread_record(tls_state_t *tls, const char *expected)
                }
        }
        if (sz < 0)
-               bb_error_msg_and_die("encrypted data too short");
+               bb_simple_error_msg_and_die("encrypted data too short");
 
        //dump_hex("<< %s\n", tls->inbuf, RECHDR_LEN + sz);
 
@@ -1411,7 +1411,7 @@ static void find_key_in_der_cert(tls_state_t *tls, uint8_t *der, int len)
                        dbg("ECDSA key\n");
                        //UNUSED: tls->flags |= GOT_CERT_ECDSA_KEY_ALG;
                } else
-                       bb_error_msg_and_die("not RSA or ECDSA cert");
+                       bb_simple_error_msg_and_die("not RSA or ECDSA cert");
        }
 
        if (tls->flags & GOT_CERT_RSA_KEY_ALG) {
@@ -1882,7 +1882,7 @@ static void process_server_key(tls_state_t *tls, int len)
        /* So far we only support curve_x25519 */
        move_from_unaligned32(t32, keybuf);
        if (t32 != htonl(0x03001d20))
-               bb_error_msg_and_die("elliptic curve is not x25519");
+               bb_simple_error_msg_and_die("elliptic curve is not x25519");
 
        memcpy(tls->hsd->ecc_pub_key32, keybuf + 4, 32);
        tls->flags |= GOT_EC_KEY;
@@ -1929,7 +1929,7 @@ static void send_client_key_exchange(tls_state_t *tls)
        if (!(tls->flags & NEED_EC_KEY)) {
                /* RSA */
                if (!(tls->flags & GOT_CERT_RSA_KEY_ALG))
-                       bb_error_msg("server cert is not RSA");
+                       bb_simple_error_msg("server cert is not RSA");
 
                tls_get_random(rsa_premaster, sizeof(rsa_premaster));
                if (TLS_DEBUG_FIXED_SECRETS)
@@ -1959,7 +1959,7 @@ static void send_client_key_exchange(tls_state_t *tls)
                uint8_t privkey[CURVE25519_KEYSIZE]; //[32]
 
                if (!(tls->flags & GOT_EC_KEY))
-                       bb_error_msg("server did not provide EC key");
+                       bb_simple_error_msg("server did not provide EC key");
 
                /* Generate random private key, see RFC 7748 */
                tls_get_random(privkey, sizeof(privkey));
@@ -2322,7 +2322,7 @@ void FAST_FUNC tls_run_copy_loop(tls_state_t *tls, unsigned flags)
                int nread;
 
                if (safe_poll(pfds, 2, -1) < 0)
-                       bb_perror_msg_and_die("poll");
+                       bb_simple_perror_msg_and_die("poll");
 
                if (pfds[0].revents) {
                        void *buf;
index 494ed78c467ff5329719da9054227ae2ecf2da05..d4ac1bef801c8a3b0e5c27af3edc4c659010016c 100644 (file)
@@ -90,7 +90,7 @@ void xorbuf_aligned_AES_BLOCK_SIZE(void* buf, const void* mask) FAST_FUNC;
 #define matrixCryptoGetPrngData(buf, len, userPtr) (tls_get_random(buf, len), PS_SUCCESS)
 
 #define psFree(p, pool)    free(p)
-#define psTraceCrypto(...) bb_error_msg_and_die(__VA_ARGS__)
+#define psTraceCrypto(msg) bb_simple_error_msg_and_die(msg)
 
 /* Secure zerofill */
 #define memset_s(A,B,C,D) memset((A),(C),(D))
index bdf45118673fc4701f248fc4b1186bf856c0a02c..0435d6ba6a81ca44307da9b04d7e1dae5c3c190a 100644 (file)
@@ -875,7 +875,7 @@ common_traceroute_main(int op, char **argv)
                 * probe (e.g., on a multi-homed host).
                 */
                if (getuid() != 0)
-                       bb_error_msg_and_die(bb_msg_you_must_be_root);
+                       bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
        }
        if (op & OPT_WAITTIME)
                waittime = xatou_range(waittime_str, 1, 24 * 60 * 60);
@@ -1003,7 +1003,7 @@ common_traceroute_main(int op, char **argv)
                if (af == AF_INET)
                        if (setsockopt(sndsock, IPPROTO_IP, IP_MULTICAST_IF,
                                        &source_lsa->u.sa, source_lsa->len))
-                               bb_error_msg_and_die("can't set multicast source interface");
+                               bb_simple_error_msg_and_die("can't set multicast source interface");
 //TODO: we can query source port we bound to,
 // and check it in replies... if we care enough
                xbind(sndsock, &source_lsa->u.sa, source_lsa->len);
@@ -1025,7 +1025,7 @@ common_traceroute_main(int op, char **argv)
                /* read IP and port */
                source_lsa = get_sock_lsa(probe_fd);
                if (source_lsa == NULL)
-                       bb_error_msg_and_die("can't get probe addr");
+                       bb_simple_error_msg_and_die("can't get probe addr");
 
                close(probe_fd);
 
index 215d023cecb4692149ef3a0315a69b7c90ef4a67..a395e838df6895f5e38f7a3348efd9360c4cf543 100644 (file)
@@ -53,12 +53,12 @@ int FAST_FUNC arpping(uint32_t test_nip,
 
        s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP));
        if (s == -1) {
-               bb_perror_msg(bb_msg_can_not_create_raw_socket);
+               bb_simple_perror_msg(bb_msg_can_not_create_raw_socket);
                return -1;
        }
 
        if (setsockopt_broadcast(s) == -1) {
-               bb_perror_msg("can't enable bcast on raw socket");
+               bb_simple_perror_msg("can't enable bcast on raw socket");
                goto ret;
        }
 
index 62ad248cee81e2f625a7131ed9d036ff377226ab..4a452cdb93995aafe64263fb54ac5d8e0679b233 100644 (file)
@@ -240,7 +240,7 @@ uint8_t* FAST_FUNC udhcp_get_option(struct dhcp_packet *packet, int code)
        while (1) {
                if (rem <= 0) {
  complain:
-                       bb_error_msg("bad packet, malformed option field");
+                       bb_simple_error_msg("bad packet, malformed option field");
                        return NULL;
                }
 
index bba3d6037436274004b2736c2e6af6e418c43339..60255eefaa503daf43f2d3728b252b7502143de3 100644 (file)
@@ -267,26 +267,45 @@ struct option_set *udhcp_find_option(struct option_set *opt_list, uint8_t code)
 # define IF_UDHCP_VERBOSE(...) __VA_ARGS__
 extern unsigned dhcp_verbose;
 # define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0)
+# define log1s(msg) do { if (dhcp_verbose >= 1) bb_simple_info_msg(msg); } while (0)
 # if CONFIG_UDHCP_DEBUG >= 2
 void udhcp_dump_packet(struct dhcp_packet *packet) FAST_FUNC;
 #  define log2(...) do { if (dhcp_verbose >= 2) bb_info_msg(__VA_ARGS__); } while (0)
+#  define log2s(msg) do { if (dhcp_verbose >= 2) bb_simple_info_msg(msg); } while (0)
 # else
 #  define udhcp_dump_packet(...) ((void)0)
 #  define log2(...) ((void)0)
+#  define log2s(msg) ((void)0)
 # endif
 # if CONFIG_UDHCP_DEBUG >= 3
 #  define log3(...) do { if (dhcp_verbose >= 3) bb_info_msg(__VA_ARGS__); } while (0)
+#  define log3s(msg) do { if (dhcp_verbose >= 3) bb_simple_info_msg(msg); } while (0)
 # else
 #  define log3(...) ((void)0)
+#  define log3s(msg) ((void)0)
 # endif
 #else
 # define IF_UDHCP_VERBOSE(...)
 # define udhcp_dump_packet(...) ((void)0)
 # define log1(...) ((void)0)
+# define log1s(msg) ((void)0)
 # define log2(...) ((void)0)
+# define log2s(msg) ((void)0)
 # define log3(...) ((void)0)
+# define log3s(msg) ((void)0)
 #endif
 
+#if defined(__mips__)
+/*
+ * The 'simple' message functions have a negative impact on the size of the
+ * DHCP code when compiled for MIPS, so don't use them in this case.
+ */
+#define bb_simple_info_msg bb_info_msg
+#define bb_simple_error_msg bb_error_msg
+#define bb_simple_perror_msg_and_die bb_perror_msg_and_die
+#undef log1s
+#define log1s log1
+#endif
 
 /*** Other shared functions ***/
 
index 4eb7ae1c19690a5bd761666bf82828334c17ce35..9d8e17c51a71c25e226e1db8ae00b8c276e9a285 100644 (file)
@@ -235,7 +235,7 @@ static char *string_option_to_env(const uint8_t *option,
  found:
        val_len = (option[2] << 8) | option[3];
        if (val_len + &option[D6_OPT_DATA] > option_end) {
-               bb_error_msg("option data exceeds option length");
+               bb_simple_error_msg("option data exceeds option length");
                return NULL;
        }
        return xasprintf("%s=%.*s", name, val_len, (char*)option + 4);
@@ -848,19 +848,19 @@ static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6, struct d6_pac
 
        bytes = safe_read(fd, &packet, sizeof(packet));
        if (bytes < 0) {
-               log1("packet read error, ignoring");
+               log1s("packet read error, ignoring");
                /* NB: possible down interface, etc. Caller should pause. */
                return bytes; /* returns -1 */
        }
 
        if (bytes < (int) (sizeof(packet.ip6) + sizeof(packet.udp))) {
-               log1("packet is too short, ignoring");
+               log1s("packet is too short, ignoring");
                return -2;
        }
 
        if (bytes < sizeof(packet.ip6) + ntohs(packet.ip6.ip6_plen)) {
                /* packet is bigger than sizeof(packet), we did partial read */
-               log1("oversized packet, ignoring");
+               log1s("oversized packet, ignoring");
                return -2;
        }
 
@@ -874,7 +874,7 @@ static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6, struct d6_pac
        /* || bytes > (int) sizeof(packet) - can't happen */
         || packet.udp.len != packet.ip6.ip6_plen
        ) {
-               log1("unrelated/bogus packet, ignoring");
+               log1s("unrelated/bogus packet, ignoring");
                return -2;
        }
 
@@ -1003,7 +1003,7 @@ static int d6_raw_socket(int ifindex)
        }
 #endif
 
-       log1("created raw socket");
+       log1s("created raw socket");
 
        return fd;
 }
@@ -1031,7 +1031,7 @@ static void change_listen_mode(int new_mode)
 /* Called only on SIGUSR1 */
 static void perform_renew(void)
 {
-       bb_info_msg("performing DHCP renew");
+       bb_simple_info_msg("performing DHCP renew");
        switch (client_data.state) {
        case BOUND:
                change_listen_mode(LISTEN_KERNEL);
@@ -1059,10 +1059,10 @@ static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *ou
         || client_data.state == REBINDING
         || client_data.state == RENEW_REQUESTED
        ) {
-               bb_info_msg("unicasting a release");
+               bb_simple_info_msg("unicasting a release");
                send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */
        }
-       bb_info_msg("entering released state");
+       bb_simple_info_msg("entering released state");
 /*
  * We can be here on: SIGUSR2,
  * or on exit (SIGTERM) and -R "release on quit" is specified.
@@ -1275,7 +1275,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
        /* Create pidfile */
        write_pidfile(client_data.pidfile);
        /* Goes to stdout (unless NOMMU) and possibly syslog */
-       bb_info_msg("started, v"BB_VER);
+       bb_simple_info_msg("started, v"BB_VER);
 
        client_data.state = INIT_SELECTING;
        d6_run_script_no_option("deconfig");
@@ -1321,7 +1321,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                        continue;
                                }
                                /* Else: an error occured, panic! */
-                               bb_perror_msg_and_die("poll");
+                               bb_simple_perror_msg_and_die("poll");
                        }
                }
 
@@ -1362,7 +1362,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                d6_run_script_no_option("leasefail");
 #if BB_MMU /* -b is not supported on NOMMU */
                                if (opt & OPT_b) { /* background if no lease */
-                                       bb_info_msg("no lease, forking to background");
+                                       bb_simple_info_msg("no lease, forking to background");
                                        client_background();
                                        /* do not background again! */
                                        opt = ((opt & ~(OPT_b|OPT_n)) | OPT_f);
@@ -1375,7 +1375,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                } else
 #endif
                                if (opt & OPT_n) { /* abort if no lease */
-                                       bb_info_msg("no lease, failing");
+                                       bb_simple_info_msg("no lease, failing");
                                        retval = 1;
                                        goto ret;
                                }
@@ -1403,7 +1403,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                client_data.state = RENEWING;
                                client_data.first_secs = 0; /* make secs field count from 0 */
                                change_listen_mode(LISTEN_KERNEL);
-                               log1("entering renew state");
+                               log1s("entering renew state");
                                /* fall right through */
                        case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
                        case_RENEW_REQUESTED:
@@ -1423,7 +1423,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                        continue;
                                }
                                /* Timed out, enter rebinding state */
-                               log1("entering rebinding state");
+                               log1s("entering rebinding state");
                                client_data.state = REBINDING;
                                /* fall right through */
                        case REBINDING:
@@ -1438,7 +1438,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                        continue;
                                }
                                /* Timed out, enter init state */
-                               bb_info_msg("lease lost, entering init state");
+                               bb_simple_info_msg("lease lost, entering init state");
                                d6_run_script_no_option("deconfig");
                                client_data.state = INIT_SELECTING;
                                client_data.first_secs = 0; /* make secs field count from 0 */
@@ -1560,7 +1560,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
                                }
                                option = d6_copy_option(packet.d6_options, packet_end, D6_OPT_SERVERID);
                                if (!option) {
-                                       bb_info_msg("no server ID, ignoring packet");
+                                       bb_simple_info_msg("no server ID, ignoring packet");
                                        continue;
                                        /* still selecting - this server looks bad */
                                }
index 01d1c930b709dd6b9f50d6209ed1394081276a22..446497e15eca31c3901e11b5c352300b78f7e42b 100644 (file)
@@ -35,12 +35,12 @@ int FAST_FUNC d6_recv_kernel_packet(struct in6_addr *peer_ipv6
        memset(packet, 0, sizeof(*packet));
        bytes = safe_read(fd, packet, sizeof(*packet));
        if (bytes < 0) {
-               log1("packet read error, ignoring");
+               log1s("packet read error, ignoring");
                return bytes; /* returns -1 */
        }
 
        if (bytes < offsetof(struct d6_packet, d6_options)) {
-               bb_info_msg("packet with bad magic, ignoring");
+               bb_simple_info_msg("packet with bad magic, ignoring");
                return -2;
        }
        log1("received %s", "a packet");
index 25e622d6f1908f20575397cf46d366af7ad5a7ba..8ddee5a8ee6278374ec11bdf5e4481b666e0d203 100644 (file)
@@ -115,7 +115,7 @@ int FAST_FUNC d6_listen_socket(int port, const char *inf)
 
        setsockopt_reuseaddr(fd);
        if (setsockopt_broadcast(fd) == -1)
-               bb_perror_msg_and_die("SO_BROADCAST");
+               bb_simple_perror_msg_and_die("SO_BROADCAST");
 
        /* NB: bug 1032 says this doesn't work on ethernet aliases (ethN:M) */
        if (setsockopt_bindtodevice(fd, inf))
index d1a0eaf02a4c49f8a59956fe040edaa59a5a0046..656295ff7ca39dcbde41bdb8222bb1b23c652dfd 100644 (file)
@@ -906,7 +906,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
                if (bytes < 0) {
                        if (errno == EINTR)
                                continue;
-                       log1("packet read error, ignoring");
+                       log1s("packet read error, ignoring");
                        /* NB: possible down interface, etc. Caller should pause. */
                        return bytes; /* returns -1 */
                }
@@ -914,13 +914,13 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
        }
 
        if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp))) {
-               log1("packet is too short, ignoring");
+               log1s("packet is too short, ignoring");
                return -2;
        }
 
        if (bytes < ntohs(packet.ip.tot_len)) {
                /* packet is bigger than sizeof(packet), we did partial read */
-               log1("oversized packet, ignoring");
+               log1s("oversized packet, ignoring");
                return -2;
        }
 
@@ -935,7 +935,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
        /* || bytes > (int) sizeof(packet) - can't happen */
         || ntohs(packet.udp.len) != (uint16_t)(bytes - sizeof(packet.ip))
        ) {
-               log1("unrelated/bogus packet, ignoring");
+               log1s("unrelated/bogus packet, ignoring");
                return -2;
        }
 
@@ -943,7 +943,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
        check = packet.ip.check;
        packet.ip.check = 0;
        if (check != inet_cksum((uint16_t *)&packet.ip, sizeof(packet.ip))) {
-               log1("bad IP header checksum, ignoring");
+               log1s("bad IP header checksum, ignoring");
                return -2;
        }
 
@@ -968,13 +968,13 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
        check = packet.udp.check;
        packet.udp.check = 0;
        if (check && check != inet_cksum((uint16_t *)&packet, bytes)) {
-               log1("packet with bad UDP checksum received, ignoring");
+               log1s("packet with bad UDP checksum received, ignoring");
                return -2;
        }
  skip_udp_sum_check:
 
        if (packet.data.cookie != htonl(DHCP_MAGIC)) {
-               bb_info_msg("packet with bad magic, ignoring");
+               bb_simple_info_msg("packet with bad magic, ignoring");
                return -2;
        }
 
@@ -1089,10 +1089,10 @@ static int udhcp_raw_socket(int ifindex)
 
        if (setsockopt_1(fd, SOL_PACKET, PACKET_AUXDATA) != 0) {
                if (errno != ENOPROTOOPT)
-                       log1("can't set PACKET_AUXDATA on raw socket");
+                       log1s("can't set PACKET_AUXDATA on raw socket");
        }
 
-       log1("created raw socket");
+       log1s("created raw socket");
 
        return fd;
 }
@@ -1120,7 +1120,7 @@ static void change_listen_mode(int new_mode)
 /* Called only on SIGUSR1 */
 static void perform_renew(void)
 {
-       bb_info_msg("performing DHCP renew");
+       bb_simple_info_msg("performing DHCP renew");
        switch (client_data.state) {
        case BOUND:
                change_listen_mode(LISTEN_KERNEL);
@@ -1158,7 +1158,7 @@ static void perform_release(uint32_t server_addr, uint32_t requested_ip)
                                inet_ntoa(temp_addr), buffer);
                send_release(server_addr, requested_ip); /* unicast */
        }
-       bb_info_msg("entering released state");
+       bb_simple_info_msg("entering released state");
 /*
  * We can be here on: SIGUSR2,
  * or on exit (SIGTERM) and -R "release on quit" is specified.
@@ -1303,7 +1303,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
        );
        if (opt & (OPT_h|OPT_H)) {
                //msg added 2011-11
-               bb_error_msg("option -h NAME is deprecated, use -x hostname:NAME");
+               bb_simple_error_msg("option -h NAME is deprecated, use -x hostname:NAME");
                client_data.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
        }
        if (opt & OPT_F) {
@@ -1397,7 +1397,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
        /* Create pidfile */
        write_pidfile(client_data.pidfile);
        /* Goes to stdout (unless NOMMU) and possibly syslog */
-       bb_info_msg("started, v"BB_VER);
+       bb_simple_info_msg("started, v"BB_VER);
        /* We want random_xid to be random... */
        srand(monotonic_us());
 
@@ -1444,7 +1444,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                        continue;
                                }
                                /* Else: an error occurred, panic! */
-                               bb_perror_msg_and_die("poll");
+                               bb_simple_perror_msg_and_die("poll");
                        }
                }
 
@@ -1485,7 +1485,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                udhcp_run_script(NULL, "leasefail");
 #if BB_MMU /* -b is not supported on NOMMU */
                                if (opt & OPT_b) { /* background if no lease */
-                                       bb_info_msg("no lease, forking to background");
+                                       bb_simple_info_msg("no lease, forking to background");
                                        client_background();
                                        /* do not background again! */
                                        opt = ((opt & ~(OPT_b|OPT_n)) | OPT_f);
@@ -1498,7 +1498,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                } else
 #endif
                                if (opt & OPT_n) { /* abort if no lease */
-                                       bb_info_msg("no lease, failing");
+                                       bb_simple_info_msg("no lease, failing");
                                        retval = 1;
                                        goto ret;
                                }
@@ -1526,7 +1526,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                client_data.state = RENEWING;
                                client_data.first_secs = 0; /* make secs field count from 0 */
                                change_listen_mode(LISTEN_KERNEL);
-                               log1("entering renew state");
+                               log1s("entering renew state");
                                /* fall right through */
                        case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
                        case_RENEW_REQUESTED:
@@ -1559,7 +1559,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                         */
                                }
                                /* Timed out or error, enter rebinding state */
-                               log1("entering rebinding state");
+                               log1s("entering rebinding state");
                                client_data.state = REBINDING;
                                /* fall right through */
                        case REBINDING:
@@ -1574,7 +1574,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                        continue;
                                }
                                /* Timed out, enter init state */
-                               bb_info_msg("lease lost, entering init state");
+                               bb_simple_info_msg("lease lost, entering init state");
                                udhcp_run_script(NULL, "deconfig");
                                client_data.state = INIT_SELECTING;
                                client_data.first_secs = 0; /* make secs field count from 0 */
@@ -1660,13 +1660,13 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                 || memcmp(packet.chaddr, client_data.client_mac, 6) != 0
                ) {
 //FIXME: need to also check that last 10 bytes are zero
-                       log1("chaddr does not match, ignoring packet"); // log2?
+                       log1("chaddr does not match%s", ", ignoring packet"); // log2?
                        continue;
                }
 
                message = udhcp_get_option(&packet, DHCP_MESSAGE_TYPE);
                if (message == NULL) {
-                       bb_info_msg("no message type option, ignoring packet");
+                       bb_info_msg("no message type option%s", ", ignoring packet");
                        continue;
                }
 
@@ -1703,7 +1703,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                server_addr = 0;
                                temp = udhcp_get_option32(&packet, DHCP_SERVER_ID);
                                if (!temp) {
-                                       bb_info_msg("no server ID, using 0.0.0.0");
+                                       bb_simple_info_msg("no server ID, using 0.0.0.0");
                                } else {
                                        /* it IS unaligned sometimes, don't "optimize" */
                                        move_from_unaligned32(server_addr, temp);
@@ -1730,7 +1730,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
 
                                temp = udhcp_get_option32(&packet, DHCP_LEASE_TIME);
                                if (!temp) {
-                                       bb_info_msg("no lease time with ACK, using 1 hour lease");
+                                       bb_simple_info_msg("no lease time with ACK, using 1 hour lease");
                                        lease_seconds = 60 * 60;
                                } else {
                                        /* it IS unaligned sometimes, don't "optimize" */
@@ -1763,7 +1763,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                                        client_data.interface,
                                                        arpping_ms)
                                        ) {
-                                               bb_info_msg("offered address is in use "
+                                               bb_simple_info_msg("offered address is in use "
                                                        "(got ARP reply), declining");
                                                send_decline(/*xid,*/ server_addr, packet.yiaddr);
 
@@ -1827,7 +1827,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
                                        if (!temp) {
  non_matching_svid:
                                                log1("received DHCP NAK with wrong"
-                                                       " server ID, ignoring packet");
+                                                       " server ID%s", ", ignoring packet");
                                                continue;
                                        }
                                        move_from_unaligned32(svid, temp);
index 022b8721bac22b910f3620b0be017202ae88e602..3e08ec01188057d97bb7b2997ae0451c167b21c3 100644 (file)
@@ -582,11 +582,11 @@ static void send_packet_to_client(struct dhcp_packet *dhcp_pkt, int force_broadc
         || (dhcp_pkt->flags & htons(BROADCAST_FLAG))
         || dhcp_pkt->ciaddr == 0
        ) {
-               log1("broadcasting packet to client");
+               log1s("broadcasting packet to client");
                ciaddr = INADDR_BROADCAST;
                chaddr = MAC_BCAST_ADDR;
        } else {
-               log1("unicasting packet to client ciaddr");
+               log1s("unicasting packet to client ciaddr");
                ciaddr = dhcp_pkt->ciaddr;
                chaddr = dhcp_pkt->chaddr;
        }
@@ -600,7 +600,7 @@ static void send_packet_to_client(struct dhcp_packet *dhcp_pkt, int force_broadc
 /* Send a packet to gateway_nip using the kernel ip stack */
 static void send_packet_to_relay(struct dhcp_packet *dhcp_pkt)
 {
-       log1("forwarding packet to relay");
+       log1s("forwarding packet to relay");
 
        udhcp_send_kernel_packet(dhcp_pkt,
                        server_data.server_nip, SERVER_PORT,
@@ -754,7 +754,7 @@ static NOINLINE void send_offer(struct dhcp_packet *oldpacket,
                }
 
                if (!packet.yiaddr) {
-                       bb_error_msg("no free IP addresses. OFFER abandoned");
+                       bb_simple_error_msg("no free IP addresses. OFFER abandoned");
                        return;
                }
                /* Reserve the IP for a short time hoping to get DHCPREQUEST soon */
@@ -765,7 +765,7 @@ static NOINLINE void send_offer(struct dhcp_packet *oldpacket,
                                p_host_name ? (unsigned char)p_host_name[OPT_LEN - OPT_DATA] : 0
                );
                if (!lease) {
-                       bb_error_msg("no free IP addresses. OFFER abandoned");
+                       bb_simple_error_msg("no free IP addresses. OFFER abandoned");
                        return;
                }
        }
@@ -914,7 +914,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
        write_pidfile(server_data.pidfile);
        /* if (!..) bb_perror_msg("can't create pidfile %s", pidfile); */
 
-       bb_info_msg("started, v"BB_VER);
+       bb_simple_info_msg("started, v"BB_VER);
 
        option = udhcp_find_option(server_data.options, DHCP_LEASE_TIME);
        server_data.max_lease_sec = DEFAULT_LEASE_TIME;
@@ -985,7 +985,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
                        if (errno == EINTR)
                                goto new_tv;
                        /* < 0 and not EINTR: should not happen */
-                       bb_perror_msg_and_die("poll");
+                       bb_simple_perror_msg_and_die("poll");
                }
 
                if (pfds[0].revents) switch (udhcp_sp_read()) {
@@ -1019,16 +1019,16 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
                        continue;
                }
                if (packet.hlen != 6) {
-                       bb_info_msg("MAC length != 6, ignoring packet");
+                       bb_info_msg("MAC length != 6%s", ", ignoring packet");
                        continue;
                }
                if (packet.op != BOOTREQUEST) {
-                       bb_info_msg("not a REQUEST, ignoring packet");
+                       bb_info_msg("not a REQUEST%s", ", ignoring packet");
                        continue;
                }
                state = udhcp_get_option(&packet, DHCP_MESSAGE_TYPE);
                if (state == NULL || state[0] < DHCP_MINTYPE || state[0] > DHCP_MAXTYPE) {
-                       bb_info_msg("no or bad message type option, ignoring packet");
+                       bb_info_msg("no or bad message type option%s", ", ignoring packet");
                        continue;
                }
 
@@ -1039,7 +1039,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
                        move_from_unaligned32(server_id_network_order, server_id_opt);
                        if (server_id_network_order != server_data.server_nip) {
                                /* client talks to somebody else */
-                               log1("server ID doesn't match, ignoring");
+                               log1("server ID doesn't match%s", ", ignoring");
                                continue;
                        }
                }
@@ -1162,7 +1162,7 @@ o DHCPREQUEST generated during REBINDING state:
                        if (!requested_ip_opt) {
                                requested_nip = packet.ciaddr;
                                if (requested_nip == 0) {
-                                       log1("no requested IP and no ciaddr, ignoring");
+                                       log1("no requested IP and no ciaddr%s", ", ignoring");
                                        break;
                                }
                        }
index 86dcb1af0802ee4935d7550fae5c25f130420b9f..ef9447b4b27da1df5206fde27a8b497c4c836215 100644 (file)
@@ -186,7 +186,7 @@ static int sendto_ip4(int sock, const void *msg, int msg_len, struct sockaddr_in
        err = sendto(sock, msg, msg_len, 0, (struct sockaddr*) to, sizeof(*to));
        err -= msg_len;
        if (err)
-               bb_perror_msg("sendto");
+               bb_simple_perror_msg("sendto");
        return err;
 }
 
@@ -273,7 +273,7 @@ int dhcprelay_main(int argc UNUSED_PARAM, char **argv)
                bb_show_usage();
        if (argv[3]) {
                if (!inet_aton(argv[3], &server_addr.sin_addr))
-                       bb_perror_msg_and_die("bad server IP");
+                       bb_simple_perror_msg_and_die("bad server IP");
        }
 
        iface_list = make_iface_list(argv + 1, &num_sockets);
index 64af802a34c5c2cf3436fd4d6d5d19e1679ac384..6d4375237245d798ba4aac74ec3c6e8692bd04af 100644 (file)
@@ -85,14 +85,14 @@ int FAST_FUNC udhcp_recv_kernel_packet(struct dhcp_packet *packet, int fd)
        memset(packet, 0, sizeof(*packet));
        bytes = safe_read(fd, packet, sizeof(*packet));
        if (bytes < 0) {
-               log1("packet read error, ignoring");
+               log1s("packet read error, ignoring");
                return bytes; /* returns -1 */
        }
 
        if (bytes < offsetof(struct dhcp_packet, options)
         || packet->cookie != htonl(DHCP_MAGIC)
        ) {
-               bb_info_msg("packet with bad magic, ignoring");
+               bb_simple_info_msg("packet with bad magic, ignoring");
                return -2;
        }
        log1("received %s", "a packet");
index 81d1fc01a898382067febf3624b0e5fbacff3f04..7df6712456ffdd77e0ed9e689603cd91ee29cec4 100644 (file)
@@ -28,7 +28,7 @@ static void signal_handler(int sig)
        int sv = errno;
        unsigned char ch = sig; /* use char, avoid dealing with partial writes */
        if (write(WRITE_FD, &ch, 1) != 1)
-               bb_perror_msg("can't send signal");
+               bb_simple_perror_msg("can't send signal");
        errno = sv;
 }
 
index 34049c3eedfa14d8d208c2a545e6856c08042316..65a1a8eadcc9fbf4c1840b5625a3b4cd86d157a8 100644 (file)
@@ -87,7 +87,7 @@ int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf)
 
        setsockopt_reuseaddr(fd);
        if (setsockopt_broadcast(fd) == -1)
-               bb_perror_msg_and_die("SO_BROADCAST");
+               bb_simple_perror_msg_and_die("SO_BROADCAST");
 
        /* SO_BINDTODEVICE doesn't work on ethernet aliases (ethN:M) */
        colon = strrchr(inf, ':');
index b6f9d605ac5630e16ddbb7f1fcf165eed38dd871..9e5a40b6fd0ee4a0c2bd6f8acdfc2e28e21abe6c 100644 (file)
@@ -368,7 +368,7 @@ static void alarm_handler(int sig UNUSED_PARAM)
 {
        /* This is theoretically unsafe (uses stdio and malloc in signal handler) */
        if (G.die_if_timed_out)
-               bb_error_msg_and_die("download timed out");
+               bb_simple_error_msg_and_die("download timed out");
 }
 static void set_alarm(void)
 {
@@ -452,7 +452,7 @@ static char fgets_trim_sanitize(FILE *fp, const char *fmt)
 
        set_alarm();
        if (fgets(G.wget_buf, sizeof(G.wget_buf), fp) == NULL)
-               bb_perror_msg_and_die("error getting response");
+               bb_simple_perror_msg_and_die("error getting response");
        clear_alarm();
 
        buf_ptr = strchrnul(G.wget_buf, '\n');
@@ -633,7 +633,7 @@ static char *get_sanitized_hdr(FILE *fp)
 
 static void reset_beg_range_to_zero(void)
 {
-       bb_error_msg("restart failed");
+       bb_simple_error_msg("restart failed");
        G.beg_range = 0;
        xlseek(G.output_fd, 0, SEEK_SET);
        /* Done at the end instead: */
@@ -651,7 +651,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
 
        if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0)
                /* Kernel can have AF_UNIX support disabled */
-               bb_perror_msg_and_die("socketpair");
+               bb_simple_perror_msg_and_die("socketpair");
 
        if (!strchr(host, ':'))
                host = allocated = xasprintf("%s:%u", host, port);
@@ -724,7 +724,7 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
 
        if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT)) {
                option_mask32 |= WGET_OPT_NO_CHECK_CERT;
-               bb_error_msg("note: TLS certificate validation not implemented");
+               bb_simple_error_msg("note: TLS certificate validation not implemented");
        }
 
        servername = xstrdup(host);
@@ -733,7 +733,7 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
 
        if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0)
                /* Kernel can have AF_UNIX support disabled */
-               bb_perror_msg_and_die("socketpair");
+               bb_simple_perror_msg_and_die("socketpair");
 
        fflush_all();
        pid = BB_MMU ? xfork() : xvfork();
@@ -785,7 +785,7 @@ static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_
 #endif
 
        if (ftpcmd(NULL, NULL, sfp) != 220)
-               bb_error_msg_and_die("%s", G.wget_buf);
+               bb_simple_error_msg_and_die(G.wget_buf);
                /* note: ftpcmd() sanitizes G.wget_buf, ok to print */
 
        /* Split username:password pair */
@@ -948,7 +948,7 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
                        if (errno != EAGAIN) {
                                if (ferror(dfp)) {
                                        progress_meter(PROGRESS_END);
-                                       bb_perror_msg_and_die(bb_msg_read_error);
+                                       bb_simple_perror_msg_and_die(bb_msg_read_error);
                                }
                                break; /* EOF, not error */
                        }
@@ -961,7 +961,7 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
 # if ENABLE_FEATURE_WGET_TIMEOUT
                                if (second_cnt != 0 && --second_cnt == 0) {
                                        progress_meter(PROGRESS_END);
-                                       bb_error_msg_and_die("download timed out");
+                                       bb_simple_error_msg_and_die("download timed out");
                                }
 # endif
                                /* We used to loop back to poll here,
@@ -1014,7 +1014,7 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
        G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */
        progress_meter(PROGRESS_END);
        if (G.content_len != 0) {
-               bb_perror_msg_and_die("connection closed prematurely");
+               bb_simple_perror_msg_and_die("connection closed prematurely");
                /* GNU wget says "DATE TIME (NN MB/s) - Connection closed at byte NNN. Retrying." */
        }
 
@@ -1348,7 +1348,7 @@ However, in real world it was observed that some web servers
                        }
                        if (key == KEY_location && status >= 300) {
                                if (--redir_limit == 0)
-                                       bb_error_msg_and_die("too many redirections");
+                                       bb_simple_error_msg_and_die("too many redirections");
                                fclose(sfp);
                                if (str[0] == '/') {
                                        free(redirected_path);
index f95b6f7fb1a2aedff98f57aec77f6e53578d028d..134dfb2df1f5c24ef1a4a0b67c859d4c00f5fba1 100644 (file)
@@ -276,7 +276,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
                if (inet_aton(l_opt, &net) == 0
                 || (net.s_addr & htonl(IN_CLASSB_NET)) != net.s_addr
                ) {
-                       bb_error_msg_and_die("invalid network address");
+                       bb_simple_error_msg_and_die("invalid network address");
                }
                G.localnet_ip = ntohl(net.s_addr);
        }
@@ -285,7 +285,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
                if (inet_aton(r_opt, &ip) == 0
                 || (ntohl(ip.s_addr) & IN_CLASSB_NET) != G.localnet_ip
                ) {
-                       bb_error_msg_and_die("invalid link address");
+                       bb_simple_error_msg_and_die("invalid link address");
                }
                chosen_nip = ip.s_addr;
        }
@@ -473,7 +473,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
 
                // Read ARP packet
                if (safe_read(sock_fd, &p, sizeof(p)) < 0) {
-                       bb_perror_msg_and_die(bb_msg_read_error);
+                       bb_simple_perror_msg_and_die(bb_msg_read_error);
                }
 
                if (p.eth.ether_type != htons(ETHERTYPE_ARP))
index 7acb6c357a8a24953991d599f0f6768ca97988c8..77d1a79a4fec8d2b5de4cf701ed5566485d79eca 100644 (file)
@@ -167,7 +167,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
        // LPR ------------------------
        //
        if (opts & LPR_V)
-               bb_error_msg("connected to server");
+               bb_simple_error_msg("connected to server");
 
        job = getpid() % 1000;
        hostname = safe_gethostname();
@@ -206,7 +206,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
                 * Standard lpr works around it by refusing to send such jobs:
                 */
                if (st.st_size == 0) {
-                       bb_error_msg("nothing to print");
+                       bb_simple_error_msg("nothing to print");
                        continue;
                }
 
@@ -246,7 +246,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
 
                // send control file
                if (opts & LPR_V)
-                       bb_error_msg("sending control file");
+                       bb_simple_error_msg("sending control file");
                /* "Acknowledgement processing must occur as usual
                 * after the command is sent." */
                cflen = (unsigned)strlen(controlfile);
@@ -262,12 +262,12 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
 
                // send data file, with name "dfaXXX"
                if (opts & LPR_V)
-                       bb_error_msg("sending data file");
+                       bb_simple_error_msg("sending data file");
                fdprintf(fd, "\x3" "%"OFF_FMT"u d%s\n", st.st_size, remote_filename);
                get_response_or_say_and_die(fd, "sending data file");
                if (bb_copyfd_size(dfd, fd, st.st_size) != st.st_size) {
                        // We're screwed. We sent less bytes than we advertised.
-                       bb_error_msg_and_die("local file changed size?!");
+                       bb_simple_error_msg_and_die("local file changed size?!");
                }
                write(fd, "", 1); // send ACK
                get_response_or_say_and_die(fd, "sending data file");
@@ -283,7 +283,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
 
                // say job accepted
                if (opts & LPR_V)
-                       bb_error_msg("job accepted");
+                       bb_simple_error_msg("job accepted");
 
                // next, please!
                job = (job + 1) % 1000;
index a30a79dd8fb79a657fdfb9523717428907cc34a5..4a2eab613c01e4f3581dad6ad45fb893339bd54a 100644 (file)
@@ -268,7 +268,7 @@ int kill_main(int argc UNUSED_PARAM, char **argv)
 #if ENABLE_KILL || ENABLE_KILLALL
        /* Pid or name is required for kill/killall */
        if (!arg) {
-               bb_error_msg("you need to specify whom to kill");
+               bb_simple_error_msg("you need to specify whom to kill");
                return EXIT_FAILURE;
        }
 
index 4ea1b5d97249569cc20e1d87a8dc7cc784a96ff4..52a436a55f27f32f24c40cfb771913f3ded9a344 100644 (file)
@@ -931,7 +931,7 @@ int mpstat_main(int argc UNUSED_PARAM, char **argv)
                                /* Get CPU number */
                                unsigned n = xatoi_positive(t);
                                if (n >= G.cpu_nr)
-                                       bb_error_msg_and_die("not that many processors");
+                                       bb_simple_error_msg_and_die("not that many processors");
                                n++;
                                G.cpu_bitmap[n >> 3] |= 1 << (n & 7);
                        }
index e70f5433ba25f778de17c43ef63b85788664eb52..d508b5f785dd97a5ac9b69b990b1b4c6fd2a3547 100644 (file)
@@ -657,7 +657,7 @@ static void show_timerstats(void)
                }
        } else {
                bb_putchar('\n');
-               bb_error_msg("no stats available; run as root or"
+               bb_simple_error_msg("no stats available; run as root or"
                                " enable the timer_stats module");
        }
 }
@@ -707,7 +707,7 @@ int powertop_main(int argc UNUSED_PARAM, char UNUSED_PARAM **argv)
 
        /* Print warning when we don't have superuser privileges */
        if (geteuid() != 0)
-               bb_error_msg("run as root to collect enough information");
+               bb_simple_error_msg("run as root to collect enough information");
 
        /* Get number of CPUs */
        G.total_cpus = get_cpu_count();
index 1d124d2d2a9a5b1ef325d36501dfe8b0284c502d..67b711168b719dbd6f859cba18461dadd1e2f7b8 100644 (file)
@@ -404,7 +404,7 @@ int pstree_main(int argc UNUSED_PARAM, char **argv)
        else {
                dump_by_user(find_proc(1), uid);
                if (!G.dumped) {
-                       bb_error_msg_and_die("no processes found");
+                       bb_simple_error_msg_and_die("no processes found");
                }
        }
 
index 89f9d23f41289f4068a6ab6572be273ce03da248..8fe53324f53d6b1fc66fb54fad4fecff2a8d619f 100644 (file)
@@ -1229,7 +1229,7 @@ int top_main(int argc UNUSED_PARAM, char **argv)
 #endif
                } /* end of "while we read /proc" */
                if (ntop == 0) {
-                       bb_error_msg("no process info in /proc");
+                       bb_simple_error_msg("no process info in /proc");
                        break;
                }
 
index 5e77245f671abc0e171c57e0e239f4dfa52d65c7..af777568fc5cd180882ac913e53542cb78f0c42c 100644 (file)
@@ -270,7 +270,7 @@ static void limit(int what, long l)
        else
                r.rlim_cur = l;
        if (setrlimit(what, &r) == -1)
-               bb_perror_msg_and_die("setrlimit");
+               bb_simple_perror_msg_and_die("setrlimit");
 }
 
 int chpst_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -467,12 +467,12 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
        if (opt & OPT_n) {
                errno = 0;
                if (nice(xatoi(nicestr)) == -1)
-                       bb_perror_msg_and_die("nice");
+                       bb_simple_perror_msg_and_die("nice");
        }
 
        if (opt & OPT_u) {
                if (setgroups(1, &ugid.gid) == -1)
-                       bb_perror_msg_and_die("setgroups");
+                       bb_simple_perror_msg_and_die("setgroups");
                xsetgid(ugid.gid);
                xsetuid(ugid.uid);
        }
index c9e5346d186a7dfa313365f5cabab99dbdcb6bfc..a250058a13caf62164d6b142563238316b92f8bb 100644 (file)
@@ -274,7 +274,7 @@ static void warnx(const char *m0, const char *m1)
 }
 static void pause_nomem(void)
 {
-       bb_error_msg(PAUSE"out of memory");
+       bb_simple_error_msg(PAUSE"out of memory");
        sleep(3);
 }
 static void pause1cannot(const char *m0)
index 5bf91710c52d176c88a44b7b5b34fd8df76843ca..afe7f713d2e0d51fa25482aa6e8951a159ffcf0a 100644 (file)
@@ -107,7 +107,7 @@ static int FAST_FUNC change_filedir_context(
 
        context_string = context_str(context);
        if (!context_string) {
-               bb_error_msg("can't obtain security context in text expression");
+               bb_simple_error_msg("can't obtain security context in text expression");
                goto skip;
        }
 
@@ -194,7 +194,7 @@ int chcon_main(int argc UNUSED_PARAM, char **argv)
                /* specified_context is never NULL -
                 * "-1" in opt_complementary prevents this. */
                if (!argv[0])
-                       bb_error_msg_and_die("too few arguments");
+                       bb_simple_error_msg_and_die("too few arguments");
        }
 
        for (i = 0; (fname = argv[i]) != NULL; i++) {
index 0286dd0be5614a6ca940a9297d7ecb94e3898ee3..f082ba61451e0d2b04e4b6c0573d40ec662be3cc 100644 (file)
@@ -29,12 +29,12 @@ int getenforce_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
 
        rc = is_selinux_enabled();
        if (rc < 0)
-               bb_error_msg_and_die("is_selinux_enabled() failed");
+               bb_simple_error_msg_and_die("is_selinux_enabled() failed");
 
        if (rc == 1) {
                rc = security_getenforce();
                if (rc < 0)
-                       bb_error_msg_and_die("getenforce() failed");
+                       bb_simple_error_msg_and_die("getenforce() failed");
 
                if (rc)
                        puts("Enforcing");
index 6d7805c8d028e721a2852cee0bb5b8899c12f095..36ddd45b91353727093fe69dff44e1769b07cfc7 100644 (file)
@@ -40,7 +40,7 @@ int getsebool_main(int argc, char **argv)
 
                rc = security_get_boolean_names(&names, &len);
                if (rc)
-                       bb_perror_msg_and_die("can't get boolean names");
+                       bb_simple_perror_msg_and_die("can't get boolean names");
 
                if (!len) {
                        puts("No booleans");
index b7930839cb8fdb4710c572244a179d0c81a2827e..eac6ba6c1984988f8a809d8330501e169ef6c046 100644 (file)
@@ -31,7 +31,7 @@ int load_policy_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
 
        rc = selinux_mkload_policy(1);
        if (rc < 0) {
-               bb_perror_msg_and_die("can't load policy");
+               bb_simple_perror_msg_and_die("can't load policy");
        }
 
        return 0;
index a5a394427091ce65ed6edcb8506f2d389ea97bfd..bc4fa23e0daeb8e3b350d979c6d8eadae4ea5d2a 100644 (file)
@@ -65,7 +65,7 @@ static context_t runcon_compute_new_context(char *user, char *role, char *type,
        security_context_t cur_context;
 
        if (getcon(&cur_context))
-               bb_error_msg_and_die("can't get current context");
+               bb_simple_error_msg_and_die("can't get current context");
 
        if (compute_trans) {
                security_context_t file_context, new_context;
@@ -75,7 +75,7 @@ static context_t runcon_compute_new_context(char *user, char *role, char *type,
                                        command);
                if (security_compute_create(cur_context, file_context,
                                        SECCLASS_PROCESS, &new_context))
-                       bb_error_msg_and_die("unable to compute a new context");
+                       bb_simple_error_msg_and_die("unable to compute a new context");
                cur_context = new_context;
        }
 
@@ -137,7 +137,7 @@ int runcon_main(int argc UNUSED_PARAM, char **argv)
        if (!(opts & OPTS_CONTEXT_COMPONENT)) {
                context = *argv++;
                if (!argv[0])
-                       bb_error_msg_and_die("no command given");
+                       bb_simple_error_msg_and_die("no command given");
        }
 
        if (context) {
index 6954aca70df6670d03e907fa73b40329bba4f4d4..098a4d1891e5702fe5dfc23a7758b32bb2499d92 100644 (file)
@@ -216,5 +216,5 @@ int sestatus_main(int argc UNUSED_PARAM, char **argv)
        return 0;
 
   error:
-       bb_perror_msg_and_die("libselinux returns unknown state");
+       bb_simple_perror_msg_and_die("libselinux returns unknown state");
 }
index c28de6ec5d75daefe562a6a5a3cb303d1bb3057c..996034f8ed205d6b6c0b64a4c2315ecac3086d9b 100644 (file)
@@ -49,7 +49,7 @@ int setenforce_main(int argc UNUSED_PARAM, char **argv)
                        continue;
                rc = security_setenforce(i & 1);
                if (rc < 0)
-                       bb_perror_msg_and_die("setenforce() failed");
+                       bb_simple_perror_msg_and_die("setenforce() failed");
                return 0;
        }
 
index 740eaf8fb24144dc30a48575d83b63cd1ea192d4..55bfb4d02d0ea8e37f3b8d13b3805d30ef0b128e 100644 (file)
@@ -182,7 +182,7 @@ static void inc_err(void)
 {
        nerr++;
        if (nerr > 9 && !FLAG_d_debug) {
-               bb_error_msg_and_die("exiting after 10 errors");
+               bb_simple_error_msg_and_die("exiting after 10 errors");
        }
 }
 
index 57911817212e1999377bb8db21d06f44743835f0..2af23acd7e72806c42ca5eed4c1a3e9f31d0581e 100644 (file)
@@ -46,7 +46,7 @@ int setsebool_main(int argc, char **argv)
        }
 
        if (security_set_boolean(argv[1], value) < 0)
-               bb_error_msg_and_die("can't set boolean");
+               bb_simple_error_msg_and_die("can't set boolean");
 
        return 0;
 }
index f82747f74bedc8e3a8a80adb782694066dd090a0..19b97e2a58c669112af705dc7fea723547d8ae48 100644 (file)
@@ -1398,7 +1398,7 @@ static void syntax_error(unsigned lineno UNUSED_PARAM, const char *msg)
        if (msg)
                bb_error_msg("syntax error: %s", msg);
        else
-               bb_error_msg("syntax error");
+               bb_simple_error_msg("syntax error");
        die_if_script();
 }
 
@@ -1637,7 +1637,7 @@ static int refill_HFILE_and_getc(HFILE *fp)
        fp->cur = fp->buf;
        n = safe_read(fp->fd, fp->buf, sizeof(fp->buf));
        if (n < 0) {
-               bb_perror_msg("read error");
+               bb_simple_perror_msg("read error");
                n = 0;
        }
        fp->end = fp->buf + n;
@@ -2282,7 +2282,7 @@ static int set_local_var(char *str, unsigned flags)
 
        eq_sign = strchr(str, '=');
        if (HUSH_DEBUG && !eq_sign)
-               bb_error_msg_and_die("BUG in setvar");
+               bb_simple_error_msg_and_die("BUG in setvar");
 
        name_len = eq_sign - str + 1; /* including '=' */
        cur_pp = &G.top_var;
@@ -2505,7 +2505,7 @@ static void set_vars_and_save_old(char **strings)
 
                eq = strchr(*s, '=');
                if (HUSH_DEBUG && !eq)
-                       bb_error_msg_and_die("BUG in varexp4");
+                       bb_simple_error_msg_and_die("BUG in varexp4");
                var_pp = get_ptr_to_local_var(*s, eq - *s);
                if (var_pp) {
                        var_p = *var_pp;
@@ -4246,7 +4246,7 @@ static int parse_redir_right_fd(o_string *as_string, struct in_str *input)
 
 //TODO: this is the place to catch ">&file" bashism (redirect both fd 1 and 2)
 
-       bb_error_msg("ambiguous redirect");
+       bb_simple_error_msg("ambiguous redirect");
        return REDIRFD_SYNTAX_ERR;
 }
 
@@ -6956,7 +6956,7 @@ static char *expand_string_to_string(const char *str, int EXP_flags, int do_unba
        } else {
                if (HUSH_DEBUG)
                        if (list[1])
-                               bb_error_msg_and_die("BUG in varexp2");
+                               bb_simple_error_msg_and_die("BUG in varexp2");
                /* actually, just move string 2*sizeof(char*) bytes back */
                overlapping_strcpy((char*)list, list[0]);
                if (do_unbackslash)
@@ -7217,7 +7217,7 @@ static void re_execute_shell(char ***to_free, const char *s,
        if (argv[0][0] == '/')
                execve(argv[0], argv, pp);
        xfunc_error_retval = 127;
-       bb_error_msg_and_die("can't re-execute the shell");
+       bb_simple_error_msg_and_die("can't re-execute the shell");
 }
 #endif  /* !BB_MMU */
 
@@ -7919,7 +7919,7 @@ static void leave_var_nest_level(void)
        G.var_nest_level--;
        debug_printf_env("var_nest_level-- %u\n", G.var_nest_level);
        if (HUSH_DEBUG && (int)G.var_nest_level < 0)
-               bb_error_msg_and_die("BUG: nesting underflow");
+               bb_simple_error_msg_and_die("BUG: nesting underflow");
 
        remove_nested_vars();
 }
@@ -8776,7 +8776,7 @@ static int checkjobs(struct pipe *fg_pipe, pid_t waitfor_pid)
                childpid = waitpid(-1, &status, attributes);
                if (childpid <= 0) {
                        if (childpid && errno != ECHILD)
-                               bb_perror_msg("waitpid");
+                               bb_simple_perror_msg("waitpid");
 #if ENABLE_HUSH_FAST
                        else { /* Until next SIGCHLD, waitpid's are useless */
                                G.we_have_children = (childpid == 0);
@@ -9308,7 +9308,7 @@ static NOINLINE int run_pipe(struct pipe *pi)
                argv_expanded = NULL;
                if (command->pid < 0) { /* [v]fork failed */
                        /* Clearly indicate, was it fork or vfork */
-                       bb_perror_msg(BB_MMU ? "vfork"+1 : "vfork");
+                       bb_simple_perror_msg(BB_MMU ? "vfork"+1 : "vfork");
                } else {
                        pi->alive_cmds++;
 #if ENABLE_HUSH_JOB
@@ -10617,7 +10617,7 @@ static int FAST_FUNC builtin_read(char **argv)
        }
 
        if ((uintptr_t)r > 1) {
-               bb_error_msg("%s", r);
+               bb_simple_error_msg(r);
                r = (char*)(uintptr_t)1;
        }
 
@@ -10862,7 +10862,7 @@ static int FAST_FUNC builtin_unset(char **argv)
        if (opts == (unsigned)-1)
                return EXIT_FAILURE;
        if (opts == 3) {
-               bb_error_msg("unset: -v and -f are exclusive");
+               bb_simple_error_msg("unset: -v and -f are exclusive");
                return EXIT_FAILURE;
        }
        argv += optind;
@@ -11025,7 +11025,7 @@ Test that VAR is a valid variable name?
 
        optstring = *++argv;
        if (!optstring || !(var = *++argv)) {
-               bb_error_msg("usage: getopts OPTSTRING VAR [ARGS]");
+               bb_simple_error_msg("usage: getopts OPTSTRING VAR [ARGS]");
                return EXIT_FAILURE;
        }
 
@@ -11254,7 +11254,7 @@ static int FAST_FUNC builtin_trap(char **argv)
        }
 
        if (!argv[1]) { /* no second arg */
-               bb_error_msg("trap: invalid arguments");
+               bb_simple_error_msg("trap: invalid arguments");
                return EXIT_FAILURE;
        }
 
@@ -11295,7 +11295,7 @@ static struct pipe *parse_jobspec(const char *str)
                /* It is "%%", "%+" or "%" - current job */
                jobnum = G.last_jobid;
                if (jobnum == 0) {
-                       bb_error_msg("no current job");
+                       bb_simple_error_msg("no current job");
                        return NULL;
                }
        }
@@ -11372,7 +11372,7 @@ static int FAST_FUNC builtin_fg_bg(char **argv)
                        delete_finished_job(pi);
                        return EXIT_SUCCESS;
                }
-               bb_perror_msg("kill (SIGCONT)");
+               bb_simple_perror_msg("kill (SIGCONT)");
        }
 
        if (argv[0][0] == 'f') {
index e0582adfb160affc7799daa5fafa153b02ac2bf5..a9353390320e70bd02d3f6549dbcc93a08052b2f 100644 (file)
@@ -619,7 +619,7 @@ shell_builtin_ulimit(char **argv)
                                limit.rlim_cur = val;
 //bb_error_msg("setrlimit(%d, %lld, %lld)", limits_tbl[i].cmd, (long long)limit.rlim_cur, (long long)limit.rlim_max);
                        if (setrlimit(limits_tbl[i].cmd, &limit) < 0) {
-                               bb_perror_msg("error setting limit");
+                               bb_simple_perror_msg("error setting limit");
                                return EXIT_FAILURE;
                        }
                }
index 17b6ca23543d70c743a4197d85ddcbb5b68cb4ad..bdd0b63251ecfb63d4b90f2d0de04a6bef8439f2 100644 (file)
@@ -244,7 +244,7 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
                if (n < 0) {
                        if (errno == EINTR)
                                continue;
-                       bb_perror_msg(READ_ERROR);
+                       bb_simple_perror_msg(READ_ERROR);
                        break;
                }
                start[n] = '\0';
index ea41fc0c8f69302f1be912f04d0eab58d592e9d3..1e1f1347f3b697ca010c9fcc42447ba89d13db08 100644 (file)
@@ -88,7 +88,7 @@ static void error_exit(const char *str)
 }
 #else
 /* On Linux, shmdt is not mandatory on exit */
-# define error_exit(str) bb_perror_msg_and_die(str)
+# define error_exit(str) bb_simple_perror_msg_and_die(str)
 #endif
 
 /*
index d0dd1bd20bad0eac25f14a6ca2bcce6c56a5abfd..0e226124a00777c4c9be29541d1eecb38a03c64e 100644 (file)
@@ -572,12 +572,12 @@ static void ipcsyslog_init(void)
 
        G.shmid = shmget(KEY_ID, G.shm_size, IPC_CREAT | 0644);
        if (G.shmid == -1) {
-               bb_perror_msg_and_die("shmget");
+               bb_simple_perror_msg_and_die("shmget");
        }
 
        G.shbuf = shmat(G.shmid, NULL, 0);
        if (G.shbuf == (void*) -1L) { /* shmat has bizarre error return */
-               bb_perror_msg_and_die("shmat");
+               bb_simple_perror_msg_and_die("shmat");
        }
 
        memset(G.shbuf, 0, G.shm_size);
@@ -592,7 +592,7 @@ static void ipcsyslog_init(void)
                        if (G.s_semid != -1)
                                return;
                }
-               bb_perror_msg_and_die("semget");
+               bb_simple_perror_msg_and_die("semget");
        }
 }
 
@@ -603,7 +603,7 @@ static void log_to_shmem(const char *msg)
        int len;
 
        if (semop(G.s_semid, G.SMwdn, 3) == -1) {
-               bb_perror_msg_and_die("SMwdn");
+               bb_simple_perror_msg_and_die("SMwdn");
        }
 
        /* Circular Buffer Algorithm:
@@ -631,7 +631,7 @@ static void log_to_shmem(const char *msg)
                goto again;
        }
        if (semop(G.s_semid, G.SMwup, 1) == -1) {
-               bb_perror_msg_and_die("SMwup");
+               bb_simple_perror_msg_and_die("SMwup");
        }
        if (DEBUG)
                printf("tail:%d\n", G.shbuf->tail);
index 7274b686637428950ff923b4c011a2ea002324b7..95f8150e2809505b19d4408c5322d0454b6cc461 100644 (file)
@@ -148,7 +148,7 @@ static void process_event(const char *event)
        const char *args[] = { "run-parts", handler, NULL };
 
        // log the event
-       bb_error_msg("%s", event);
+       bb_simple_error_msg(event);
 
        // spawn handler
        // N.B. run-parts would require scripts to have #!/bin/sh
index b797c7b2afcf51705da7f1131e959269d656e8af..a1f26914255bb41e8321f18c8e2460b58f847950 100644 (file)
@@ -74,7 +74,7 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
        opts = getopt32(argv, "cs:+n:+r", &len, &level);
        if (opts & OPT_n) {
                if (klogctl(8, NULL, (long) level))
-                       bb_perror_msg_and_die("klogctl");
+                       bb_simple_perror_msg_and_die("klogctl");
                return EXIT_SUCCESS;
        }
 
@@ -88,7 +88,7 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
        buf = xmalloc(len);
        len = klogctl(3 + (opts & OPT_c), buf, len); /* read ring buffer */
        if (len < 0)
-               bb_perror_msg_and_die("klogctl");
+               bb_simple_perror_msg_and_die("klogctl");
        if (len == 0)
                return EXIT_SUCCESS;
 
index 749e2c986a37b836b615d867448a0dbd5e6dfe02..3ccb4ae89366ac4de8425646d929c70b68843be7 100644 (file)
@@ -70,7 +70,7 @@ static void eject_scsi(const char *dev)
        sg_io_hdr_t io_hdr;
 
        if ((ioctl(dev_fd, SG_GET_VERSION_NUM, &i) < 0) || (i < 30000))
-               bb_error_msg_and_die("not a sg device or old sg driver");
+               bb_simple_error_msg_and_die("not a sg device or old sg driver");
 
        memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
        io_hdr.interface_id = 'S';
index ff3bc4870cd307a0ab99c47644db2557e8b8fe61..e1c8561d66dfe18d82395a1701c97f553e4b2368 100644 (file)
@@ -117,7 +117,7 @@ int fdformat_main(int argc UNUSED_PARAM, char **argv)
                        read_bytes = safe_read(fd, data, n);
                        if (read_bytes != n) {
                                if (read_bytes < 0) {
-                                       bb_perror_msg(bb_msg_read_error);
+                                       bb_simple_perror_msg(bb_msg_read_error);
                                }
                                bb_error_msg_and_die("problem reading cylinder %d, "
                                        "expected %d, read %d", cyl, n, read_bytes);
index 58e93bb9290284deeef1e4992b095b959ecb37ee..f28d4fdd28972b0d1054e47b9977550faccb2474 100644 (file)
@@ -511,7 +511,7 @@ static sector_t bb_BLKGETSIZE_sectors(int fd)
                         * we support can't record more than 32 bit
                         * sector counts or offsets
                         */
-                       bb_error_msg("device has more than 2^32 sectors, can't use all of them");
+                       bb_simple_error_msg("device has more than 2^32 sectors, can't use all of them");
                        v64 = (uint32_t)-1L;
                }
                return v64;
index 130627e93d7adbf57658ba50730f5bd7b180941d..12c16013c598db886825688a323b0b224871ebbf 100644 (file)
@@ -73,7 +73,7 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
        ) {
                argv++;
                if (argv[1])
-                       bb_error_msg_and_die("-c takes only one argument");
+                       bb_simple_error_msg_and_die("-c takes only one argument");
                opt |= OPT_c;
        }
 
index f523da945a5a78d6662554607490fb7e63124a40..40b86d01bdefda134045209ebf32cc922e8d4c82 100644 (file)
@@ -321,7 +321,7 @@ static void die(const char *str)
 {
        if (termios_set)
                tcsetattr_stdin_TCSANOW(&sv_termios);
-       bb_error_msg_and_die("%s", str);
+       bb_simple_error_msg_and_die(str);
 }
 
 static void push_filename(const char *name)
index 1666d3d301ac86b4a165a5defd20abb6a65a7412..db7db6ff8082c6d8aee20016db0de60b19d12c18 100644 (file)
@@ -308,7 +308,7 @@ static struct option *add_long_options(struct option *long_options, char *option
                                }
                                tokptr[tlen] = '\0';
                                if (tlen == 0)
-                                       bb_error_msg_and_die("empty long option specified");
+                                       bb_simple_error_msg_and_die("empty long option specified");
                        }
                        long_options = xrealloc_vector(long_options, 4, long_nr);
                        long_options[long_nr].has_arg = arg_opt;
@@ -380,7 +380,7 @@ int getopt_main(int argc, char **argv)
                        puts(" --");
                        return 0;
                }
-               bb_error_msg_and_die("missing optstring argument");
+               bb_simple_error_msg_and_die("missing optstring argument");
        }
 
        if (argv[1][0] != '-' || compatible) {
@@ -416,7 +416,7 @@ int getopt_main(int argc, char **argv)
        if (!optstr) {
                optstr = argv[++n];
                if (!optstr)
-                       bb_error_msg_and_die("missing optstring argument");
+                       bb_simple_error_msg_and_die("missing optstring argument");
        }
 
        argv[n] = name ? name : argv[0];
index 29f51021e813ece6c81205d5a357fa6678c190a1..dc97d8fb47d044382c571f2c192fed2f95d47d08 100644 (file)
@@ -132,7 +132,7 @@ static void to_sys_clock(const char **pp_rtcname, int utc)
        tv.tv_sec = read_rtc(pp_rtcname, NULL, utc);
        tv.tv_usec = 0;
        if (settimeofday(&tv, &tz))
-               bb_perror_msg_and_die("settimeofday");
+               bb_simple_perror_msg_and_die("settimeofday");
 }
 
 static void from_sys_clock(const char **pp_rtcname, int utc)
@@ -284,7 +284,7 @@ static void set_system_clock_timezone(int utc)
        if (!utc)
                tv.tv_sec += tz.tz_minuteswest * 60;
        if (settimeofday(&tv, &tz))
-               bb_perror_msg_and_die("settimeofday");
+               bb_simple_perror_msg_and_die("settimeofday");
 }
 
 //usage:#define hwclock_trivial_usage
index 4863a5c29ce6e7fecec1ebb8b55d5ec97955e8a6..df86cfb9db79c210ccc23a0a9af42af2d16ff49d 100644 (file)
@@ -467,7 +467,7 @@ static void print_shm(int shmid)
        struct ipc_perm *ipcp = &shmds.shm_perm;
 
        if (shmctl(shmid, IPC_STAT, &shmds) == -1) {
-               bb_perror_msg("shmctl");
+               bb_simple_perror_msg("shmctl");
                return;
        }
 
@@ -493,7 +493,7 @@ static void print_msg(int msqid)
        struct ipc_perm *ipcp = &buf.msg_perm;
 
        if (msgctl(msqid, IPC_STAT, &buf) == -1) {
-               bb_perror_msg("msgctl");
+               bb_simple_perror_msg("msgctl");
                return;
        }
 
@@ -527,7 +527,7 @@ static void print_sem(int semid)
 
        arg.buf = &semds;
        if (semctl(semid, 0, IPC_STAT, arg)) {
-               bb_perror_msg("semctl");
+               bb_simple_perror_msg("semctl");
                return;
        }
 
@@ -555,7 +555,7 @@ static void print_sem(int semid)
                zcnt = semctl(semid, i, GETZCNT, arg);
                pid = semctl(semid, i, GETPID, arg);
                if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) {
-                       bb_perror_msg_and_die("semctl");
+                       bb_simple_perror_msg_and_die("semctl");
                }
                printf("%-10u %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
        }
index 689aa7a34d659cb6919771e07795a145961002ac..24ce7a8d89d517ce17ce59ada5402f8db4a597ce 100644 (file)
@@ -100,7 +100,7 @@ int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
        pos = lseek(file, pos - sizeof(ut), SEEK_SET);
        while ((n = full_read(file, &ut, sizeof(ut))) > 0) {
                if (n != sizeof(ut)) {
-                       bb_perror_msg_and_die("short read");
+                       bb_simple_perror_msg_and_die("short read");
                }
                n = index_in_strings(_ut_lin, ut.ut_line);
                if (n == _TILDE) { /* '~' */
index 5dc7570748077421c94dc494da92219269e8fafa..cc6c2b1d54e67a263ac3af91dd0684fbf84fc77f 100644 (file)
@@ -118,13 +118,13 @@ int losetup_main(int argc UNUSED_PARAM, char **argv)
 
                n = get_free_loop();
                if (n == -1)
-                       bb_error_msg_and_die("no free loop devices");
+                       bb_simple_error_msg_and_die("no free loop devices");
                if (n < 0) /* n == -2: no /dev/loop-control, use legacy method */
                        n = 0;
                /* or: n >= 0: the number of next free loopdev, just verify it */
                do {
                        if (n > MAX_LOOP_NUM)
-                               bb_error_msg_and_die("no free loop devices");
+                               bb_simple_error_msg_and_die("no free loop devices");
                        sprintf(dev, LOOP_FORMAT, n++);
                        s = query_loop(dev);
                        free(s);
index 9cb3586f185829430879acfcb4673bdf923ecafe..207a112c188a156e50186aef246d8ce4123a4a81 100644 (file)
 
 #if DEBUG_LVL >= 1
 # define dbg1(...) do { if (G.verbose) bb_error_msg(__VA_ARGS__); } while(0)
+# define dbg1s(msg) do { if (G.verbose) bb_simple_error_msg(msg); } while(0)
 #else
 # define dbg1(...) ((void)0)
+# define dbg1s(msg) ((void)0)
 #endif
 #if DEBUG_LVL >= 2
 # define dbg2(...) do { if (G.verbose >= 2) bb_error_msg(__VA_ARGS__); } while(0)
+# define dbg2s(msg) do { if (G.verbose >= 2) bb_simple_error_msg(msg); } while(0)
 #else
 # define dbg2(...) ((void)0)
+# define dbg2s(msg) ((void)0)
 #endif
 #if DEBUG_LVL >= 3
 # define dbg3(...) do { if (G.verbose >= 3) bb_error_msg(__VA_ARGS__); } while(0)
+# define dbg3s(msg) do { if (G.verbose >= 3) bb_simple_error_msg(msg); } while(0)
 #else
 # define dbg3(...) ((void)0)
+# define dbg3s(msg) ((void)0)
 #endif
 
 
@@ -1021,7 +1027,7 @@ wait_for_seqfile(unsigned expected_seq)
                        /* seed file: write out seq ASAP */
                        xwrite_str(seq_fd, utoa(expected_seq));
                        xlseek(seq_fd, 0, SEEK_SET);
-                       dbg2("first seq written");
+                       dbg2s("first seq written");
                        break;
                }
                seqbufnum = atoll(seqbuf);
@@ -1165,7 +1171,7 @@ static void daemon_loop(char *temp, int fd)
 
                len = safe_read(fd, netbuf, sizeof(netbuf) - 1);
                if (len < 0) {
-                       bb_perror_msg_and_die("read");
+                       bb_simple_perror_msg_and_die("read");
                }
                end = netbuf + len;
                *end = '\0';
index c7b696853adb2ca0354650191e2c55c16da532c8..8c032555b956443e9de99c32022902a7c501f0e5 100644 (file)
@@ -65,7 +65,7 @@ int mesg_main(int argc UNUSED_PARAM, char **argv)
         */
 
        if (!isatty(STDIN_FILENO))
-               bb_error_msg_and_die("not a tty");
+               bb_simple_error_msg_and_die("not a tty");
 
        xfstat(STDIN_FILENO, &sb, "stdin");
        if (c == 0) {
index 845ba0a2495c8b6a705490e2424bcbd9d4493ce5..d568f4be552053584473f004c376d5722b98fd8c 100644 (file)
@@ -266,7 +266,7 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
        // N.B. what if we format a file? find_mount_point will return false negative since
        // it is loop block device which is mounted!
        if (find_mount_point(argv[0], 0))
-               bb_error_msg_and_die("can't format mounted filesystem");
+               bb_simple_error_msg_and_die("can't format mounted filesystem");
 
        // get size in kbytes
        kilobytes = get_volume_size_in_bytes(fd, argv[1], 1024, /*extend:*/ !(option_mask32 & OPT_n)) / 1024;
@@ -326,11 +326,11 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
        kilobytes >>= (blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE);
        nblocks = kilobytes;
        if (nblocks != kilobytes)
-               bb_error_msg_and_die("block count doesn't fit in 32 bits");
+               bb_simple_error_msg_and_die("block count doesn't fit in 32 bits");
 #define kilobytes kilobytes_unused_after_this
        // Experimentally, standard mke2fs won't work on images smaller than 60k
        if (nblocks < 60)
-               bb_error_msg_and_die("need >= 60 blocks");
+               bb_simple_error_msg_and_die("need >= 60 blocks");
 
        // How many reserved blocks?
        if (reserved_percent > 50)
index e191acbd0c01c2402a92cc51d6b1e354513cd337..8f791cf66e251ecf0f01f117f203786b3d8aaa74 100644 (file)
@@ -262,7 +262,7 @@ static int get_free_block(void)
        int blk;
 
        if (G.used_good_blocks + 1 >= MAX_GOOD_BLOCKS)
-               bb_error_msg_and_die("too many bad blocks");
+               bb_simple_error_msg_and_die("too many bad blocks");
        if (G.used_good_blocks)
                blk = G.good_blocks_table[G.used_good_blocks - 1] + 1;
        else
@@ -270,7 +270,7 @@ static int get_free_block(void)
        while (blk < SB_ZONES && zone_in_use(blk))
                blk++;
        if (blk >= SB_ZONES)
-               bb_error_msg_and_die("not enough good blocks");
+               bb_simple_error_msg_and_die("not enough good blocks");
        G.good_blocks_table[G.used_good_blocks] = blk;
        G.used_good_blocks++;
        return blk;
@@ -342,7 +342,7 @@ static void make_bad_inode(void)
                                goto end_bad;
                }
        }
-       bb_error_msg_and_die("too many bad blocks");
+       bb_simple_error_msg_and_die("too many bad blocks");
  end_bad:
        if (ind)
                write_block(ind, (char *) ind_block);
@@ -398,7 +398,7 @@ static void make_bad_inode2(void)
                }
        }
        /* Could make triple indirect block here */
-       bb_error_msg_and_die("too many bad blocks");
+       bb_simple_error_msg_and_die("too many bad blocks");
  end_bad:
        if (ind)
                write_block(ind, (char *) ind_block);
@@ -514,7 +514,7 @@ static void check_blocks(void)
                if (got == try)
                        continue;
                if (G.currently_testing < SB_FIRSTZONE)
-                       bb_error_msg_and_die("bad blocks before data-area: cannot make fs");
+                       bb_simple_error_msg_and_die("bad blocks before data-area: cannot make fs");
                mark_zone(G.currently_testing);
                G.badblocks++;
                G.currently_testing++;
@@ -588,7 +588,7 @@ static void setup_tables(void)
                SB_ZMAPS = sb_zmaps;
                /* new SB_ZMAPS, need to recalc NORM_FIRSTZONE */
        } while (--i);
-       bb_error_msg_and_die("incompatible size/inode count, try different -i N");
+       bb_simple_error_msg_and_die("incompatible size/inode count, try different -i N");
  got_it:
 
        SB_FIRSTZONE = norm_firstzone;
@@ -623,10 +623,10 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
        G.magic = MINIX1_SUPER_MAGIC2;
 
        if (INODE_SIZE1 * MINIX1_INODES_PER_BLOCK != BLOCK_SIZE)
-               bb_error_msg_and_die("bad inode size");
+               bb_simple_error_msg_and_die("bad inode size");
 #if ENABLE_FEATURE_MINIX2
        if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
-               bb_error_msg_and_die("bad inode size");
+               bb_simple_error_msg_and_die("bad inode size");
 #endif
 
        opt = getopt32(argv, "ci:l:n:+v", &str_i, &listfile, &G.namelen);
@@ -644,7 +644,7 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
 #if ENABLE_FEATURE_MINIX2
                version2 = 1;
 #else
-               bb_error_msg_and_die("not compiled with minix v2 support");
+               bb_simple_error_msg_and_die("not compiled with minix v2 support");
 #endif
        }
 
@@ -654,14 +654,14 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
 
        /* Check if it is mounted */
        if (find_mount_point(G.device_name, 0))
-               bb_error_msg_and_die("can't format mounted filesystem");
+               bb_simple_error_msg_and_die("can't format mounted filesystem");
 
        xmove_fd(xopen(G.device_name, O_RDWR), dev_fd);
 
        G.total_blocks = get_volume_size_in_bytes(dev_fd, argv[1], 1024, /*extend:*/ 1) / 1024;
 
        if (G.total_blocks < 10)
-               bb_error_msg_and_die("must have at least 10 blocks");
+               bb_simple_error_msg_and_die("must have at least 10 blocks");
 
        if (version2) {
                G.magic = MINIX2_SUPER_MAGIC2;
index b4c8dda6ff40aaecf7da9cc1a7337fadec2b5f26..d2eaf5f94185bf235df01582a0617513965acd6f 100644 (file)
@@ -178,7 +178,7 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv)
        // N.B. what if we format a file? find_mount_point will return false negative since
        // it is loop block device which is mounted!
        if (find_mount_point(argv[0], 0))
-               bb_error_msg_and_die("can't format mounted filesystem");
+               bb_simple_error_msg_and_die("can't format mounted filesystem");
 
        // open the device, get size in blocks
        blocks = get_volume_size_in_bytes(fd, argv[1], blocksize, /*extend:*/ 1) / blocksize;
index b760fb2aa6959f3af5027a139bc4eb5f2b7d3e9a..16c1fac00f2d2d04595d70757d56d003748d9598 100644 (file)
@@ -278,7 +278,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
        if (!S_ISBLK(st.st_mode)) {
                if (!S_ISREG(st.st_mode)) {
                        if (!argv[1])
-                               bb_error_msg_and_die("image size must be specified");
+                               bb_simple_error_msg_and_die("image size must be specified");
                }
                // not a block device, skip bad sectors check
                opts &= ~OPT_c;
@@ -399,7 +399,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
        // "mkdosfs -v -F 32 image5k 5" is the minimum:
        // 2 sectors for FATs and 2 data sectors
        if ((off_t)(volume_size_sect - reserved_sect) < 4)
-               bb_error_msg_and_die("the image is too small for FAT32");
+               bb_simple_error_msg_and_die("the image is too small for FAT32");
        sect_per_fat = 1;
        while (1) {
                while (1) {
@@ -439,7 +439,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
                }
  next:
                if (sect_per_clust == 128)
-                       bb_error_msg_and_die("can't make FAT32 with >128 sectors/cluster");
+                       bb_simple_error_msg_and_die("can't make FAT32 with >128 sectors/cluster");
                sect_per_clust *= 2;
                sect_per_fat = (sect_per_fat / 2) | 1;
        }
index 38413606d6dd54f172ef794d72e3e09583102f66..9e51a1dccbf02cee650b68d19d529b17d051d6ed 100644 (file)
@@ -75,7 +75,7 @@ static void mkswap_selinux_setcontext(int fd, const char *path)
        }
        return;
  error:
-       bb_perror_msg_and_die("SELinux relabeling failed");
+       bb_simple_perror_msg_and_die("SELinux relabeling failed");
 }
 #else
 # define mkswap_selinux_setcontext(fd, path) ((void)0)
index e6bad7c2c847983f086d129658274b18c88931e2..84c85c0578ea1bb10ec755b14aa529f6a670784a 100644 (file)
@@ -483,7 +483,7 @@ static void FAST_FUNC update_mtab_entry_on_move(const struct mntent *mp)
 
        mountTable = setmntent(bb_path_mtab_file, "r");
        if (!mountTable) {
-               bb_perror_msg(bb_path_mtab_file);
+               bb_simple_perror_msg(bb_path_mtab_file);
                return;
        }
 
@@ -511,7 +511,7 @@ static void FAST_FUNC update_mtab_entry_on_move(const struct mntent *mp)
                }
                endmntent(mountTable);
        } else if (errno != EROFS)
-               bb_perror_msg(bb_path_mtab_file);
+               bb_simple_perror_msg(bb_path_mtab_file);
 
        if (ENABLE_FEATURE_CLEAN_UP) {
                for (i = 0; i < count; i++) {
@@ -739,7 +739,7 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero
        // Abort entirely if permission denied.
 
        if (rc && errno == EPERM)
-               bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
+               bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
 
        // If the mount was successful, and we're maintaining an old-style
        // mtab file by hand, add the new entry to it now.
@@ -751,7 +751,7 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero
                int i;
 
                if (!mountTable) {
-                       bb_perror_msg(bb_path_mtab_file);
+                       bb_simple_perror_msg(bb_path_mtab_file);
                        goto ret;
                }
 
@@ -1288,18 +1288,18 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
        s = strchr(hostname, ',');
        if (s) {
                *s = '\0';
-               bb_error_msg("warning: multiple hostnames not supported");
+               bb_simple_error_msg("warning: multiple hostnames not supported");
        }
 
        server_addr.sin_family = AF_INET;
        if (!inet_aton(hostname, &server_addr.sin_addr)) {
                hp = gethostbyname(hostname);
                if (hp == NULL) {
-                       bb_herror_msg("%s", hostname);
+                       bb_simple_herror_msg(hostname);
                        goto fail;
                }
                if (hp->h_length != (int)sizeof(struct in_addr)) {
-                       bb_error_msg_and_die("only IPv4 is supported");
+                       bb_simple_error_msg_and_die("only IPv4 is supported");
                }
                memcpy(&server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
        }
@@ -1389,7 +1389,7 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
                                else if (is_prefixed_with(opteq, "udp"))
                                        tcp = 0;
                                else
-                                       bb_error_msg("warning: unrecognized proto= option");
+                                       bb_simple_error_msg("warning: unrecognized proto= option");
                                continue;
                        case 20: // "addr" - ignore
                                continue;
@@ -1522,7 +1522,7 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
                                if (nfs_mount_version >= 3)
                                        nolock = !val;
                                else
-                                       bb_error_msg("warning: option nolock is not supported");
+                                       bb_simple_error_msg("warning: option nolock is not supported");
                                break;
                        case 11: //rdirplus
                                nordirplus = !val;
@@ -1590,11 +1590,11 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
                } else {
                        hp = gethostbyname(mounthost);
                        if (hp == NULL) {
-                               bb_herror_msg("%s", mounthost);
+                               bb_simple_herror_msg(mounthost);
                                goto fail;
                        }
                        if (hp->h_length != (int)sizeof(struct in_addr)) {
-                               bb_error_msg_and_die("only IPv4 is supported");
+                               bb_simple_error_msg_and_die("only IPv4 is supported");
                        }
                        mount_server_addr.sin_family = AF_INET;
                        memcpy(&mount_server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
@@ -1767,18 +1767,18 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
        /* Create nfs socket for kernel */
        if (tcp) {
                if (nfs_mount_version < 3) {
-                       bb_error_msg("NFS over TCP is not supported");
+                       bb_simple_error_msg("NFS over TCP is not supported");
                        goto fail;
                }
                fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        } else
                fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
        if (fsock < 0) {
-               bb_perror_msg("nfs socket");
+               bb_simple_perror_msg("nfs socket");
                goto fail;
        }
        if (bindresvport(fsock, 0) < 0) {
-               bb_perror_msg("nfs bindresvport");
+               bb_simple_perror_msg("nfs bindresvport");
                goto fail;
        }
        if (port == 0) {
@@ -2047,9 +2047,9 @@ static int singlemount(struct mntent *mp, int ignore_busy)
                        );
                        if (loopfd < 0) {
                                if (errno == EPERM || errno == EACCES)
-                                       bb_error_msg(bb_msg_perm_denied_are_you_root);
+                                       bb_simple_error_msg(bb_msg_perm_denied_are_you_root);
                                else
-                                       bb_perror_msg("can't setup loop device");
+                                       bb_simple_perror_msg("can't setup loop device");
                                return errno;
                        }
 
@@ -2255,7 +2255,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
                // argument when we get it.
                if (argv[1]) {
                        if (nonroot)
-                               bb_error_msg_and_die(bb_msg_you_must_be_root);
+                               bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
                        mtpair->mnt_fsname = argv[0];
                        mtpair->mnt_dir = argv[1];
                        mtpair->mnt_type = fstype;
@@ -2272,7 +2272,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
 
        cmdopt_flags = parse_mount_options(cmdopts, NULL);
        if (nonroot && (cmdopt_flags & ~MS_SILENT)) // Non-root users cannot specify flags
-               bb_error_msg_and_die(bb_msg_you_must_be_root);
+               bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
 
        // If we have a shared subtree flag, don't worry about fstab or mtab.
        if (ENABLE_FEATURE_MOUNT_FLAGS
@@ -2337,7 +2337,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
                        // No, mount -a won't mount anything,
                        // even user mounts, for mere humans
                        if (nonroot)
-                               bb_error_msg_and_die(bb_msg_you_must_be_root);
+                               bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
 
                        // Does type match? (NULL matches always)
                        if (!fstype_matches(mtcur->mnt_type, fstype))
@@ -2417,7 +2417,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
                        // fstab must have "users" or "user"
                        l = parse_mount_options(mtcur->mnt_opts, NULL);
                        if (!(l & MOUNT_USERS))
-                               bb_error_msg_and_die(bb_msg_you_must_be_root);
+                               bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
                }
 
                //util-linux-2.12 does not do this check.
index 4eeaa9f3edfc0f1c5bc36a1f74c23f010947fe24..304f2d7480e0a39f0f877ffd7d09989b6cd8624f 100644 (file)
@@ -257,7 +257,7 @@ int nsenter_main(int argc UNUSED_PARAM, char **argv)
 
        if (opts & OPT_setgid) {
                if (setgroups(0, NULL) < 0 && setgroups_failed)
-                       bb_perror_msg_and_die("setgroups");
+                       bb_simple_perror_msg_and_die("setgroups");
                xsetgid(gid);
        }
        if (opts & OPT_setuid)
index 70f829e7fec79f800d6ac9ca0c363b8a3334ee9b..41aade5ea67ace14000396e8e474e214a5d4d3dc 100644 (file)
@@ -33,7 +33,7 @@ enum { RFC_868_BIAS = 2208988800UL };
 
 static void socket_timeout(int sig UNUSED_PARAM)
 {
-       bb_error_msg_and_die("timeout connecting to time server");
+       bb_simple_error_msg_and_die("timeout connecting to time server");
 }
 
 static time_t askremotedate(const char *host)
@@ -94,10 +94,10 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
 
        if (!(flags & 2)) { /* no -p (-s may be present) */
                if (time(NULL) == remote_time)
-                       bb_error_msg("current time matches remote time");
+                       bb_simple_error_msg("current time matches remote time");
                else
                        if (stime(&remote_time) < 0)
-                               bb_perror_msg_and_die("can't set time of day");
+                               bb_simple_perror_msg_and_die("can't set time of day");
        }
 
        if (flags != 1) /* not lone -s */
index cab2c4319ad9610faf55869d423b90004f30b37c..c4ea374be8cc31092d07f255f3f11a5d35bd5f54 100644 (file)
@@ -142,7 +142,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
                                small++;
                }
                if (big > small) {
-                       bb_error_msg("assuming reversed byte order, "
+                       bb_simple_error_msg("assuming reversed byte order, "
                                "use -n to force native byte order");
                        BUILD_BUG_ON(sizeof(*p) > 8);
                        for (p = buf; p < buf+len; p++) {
@@ -204,7 +204,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
                }
 
                if (indx >= len)
-                       bb_error_msg_and_die("profile address out of range. "
+                       bb_simple_error_msg_and_die("profile address out of range. "
                                        "Wrong map file?");
 
                this = 0;
index 29c440b82940145e76b772108a01a2471c54c9a5..cad0f9d64fa9e610ca6bfc20620981a9c2c81559 100644 (file)
@@ -230,7 +230,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv)
                do {
                        ssize_t ret = safe_read(fd, &data, sizeof(data));
                        if (ret < 0) {
-                               bb_perror_msg("rtc read");
+                               bb_simple_perror_msg("rtc read");
                                break;
                        }
                } while (!(data & RTC_AF));
index b69b8cbb6d8b8d2aac5196eb5391dce3c1c5518b..e5cf96957811f1bf197694850e0c69d0ff7c8d1b 100644 (file)
@@ -164,7 +164,7 @@ static void set_inh_caps(char *capstring)
        }
 
        if (capset(&caps.header, caps.data) != 0)
-               bb_perror_msg_and_die("capset");
+               bb_simple_perror_msg_and_die("capset");
 }
 
 static void set_ambient_caps(char *string)
@@ -178,10 +178,10 @@ static void set_ambient_caps(char *string)
                idx = parse_cap(cap);
                if (cap[0] == '+') {
                        if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, idx, 0, 0) < 0)
-                               bb_perror_msg("cap_ambient_raise");
+                               bb_simple_perror_msg("cap_ambient_raise");
                } else {
                        if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, idx, 0, 0) < 0)
-                               bb_perror_msg("cap_ambient_lower");
+                               bb_simple_perror_msg("cap_ambient_lower");
                }
                cap = strtok(NULL, ",");
        }
@@ -236,7 +236,7 @@ static int dump(void)
                unsigned idx = CAP_TO_INDEX(i);
                if (idx >= caps.u32s) {
                        printf("\nindex: %u u32s: %u capability: %u\n", idx, caps.u32s, i);
-                       bb_error_msg_and_die("unsupported capability");
+                       bb_simple_error_msg_and_die("unsupported capability");
                }
                if (caps.data[idx].inheritable & CAP_TO_MASK(i)) {
                        printf_cap(fmt, i);
index ae9d412d1d7106bd6103619dd74095fa06ae7bfc..a483893ed54f196758055a136e56692356505495 100644 (file)
@@ -117,7 +117,7 @@ static void drop_capset(int cap_idx)
        getcaps(&caps);
        caps.data[CAP_TO_INDEX(cap_idx)].inheritable &= ~CAP_TO_MASK(cap_idx);
        if (capset(&caps.header, caps.data) != 0)
-               bb_perror_msg_and_die("capset");
+               bb_simple_perror_msg_and_die("capset");
 }
 
 static void drop_bounding_set(int cap_idx)
@@ -253,7 +253,7 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv)
        if ((unsigned)stfs.f_type != RAMFS_MAGIC
         && (unsigned)stfs.f_type != TMPFS_MAGIC
        ) {
-               bb_error_msg_and_die("root filesystem is not ramfs/tmpfs");
+               bb_simple_error_msg_and_die("root filesystem is not ramfs/tmpfs");
        }
 
        if (!dry_run) {
@@ -263,7 +263,7 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv)
                // Overmount / with newdir and chroot into it
                if (mount(".", "/", NULL, MS_MOVE, NULL)) {
                        // For example, fails when newroot is not a mountpoint
-                       bb_perror_msg_and_die("error moving root");
+                       bb_simple_perror_msg_and_die("error moving root");
                }
        }
        xchroot(".");
index 2f8990ed94d57ff6830d6eb6460ec5676d3187ab..7a1d7d4a73d40505536a13c90e1c55dd1d648703 100644 (file)
@@ -75,12 +75,12 @@ int uevent_main(int argc UNUSED_PARAM, char **argv)
                                        MAP_PRIVATE | MAP_ANON,
                                        /* ignored: */ -1, 0);
                if (netbuf == MAP_FAILED)
-                       bb_perror_msg_and_die("mmap");
+                       bb_simple_perror_msg_and_die("mmap");
 
                // Here we block, possibly for a very long time
                len = safe_read(fd, netbuf, BUFFER_SIZE - 1);
                if (len < 0)
-                       bb_perror_msg_and_die("read");
+                       bb_simple_perror_msg_and_die("read");
                end = netbuf + len;
                *end = '\0';
 
index 61fc711970d1f1ee3e5dd91f40e3d406cb395039..a943e7b036ab1cbde844b23141ae508c394c05c1 100644 (file)
@@ -239,7 +239,7 @@ int unshare_main(int argc UNUSED_PARAM, char **argv)
        if (setgrp_str) {
                if (strcmp(setgrp_str, "allow") == 0) {
                        if (opts & OPT_map_root) {
-                               bb_error_msg_and_die(
+                               bb_simple_error_msg_and_die(
                                        "--setgroups=allow and --map-root-user "
                                        "are mutually exclusive"
                                );