aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Byrne <james.byrne@origamienergy.com>2019-07-02 11:35:03 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-07-02 11:35:03 +0200
commit6937487be73cd4563b876413277a295a5fe2f32c (patch)
treef16cc9999a7c827891e6ec8d99c699fc791008ee
parentcaecfdc20d450686cd1f7e9b5f650322f894b3c2 (diff)
downloadbusybox-w32-6937487be73cd4563b876413277a295a5fe2f32c.tar.gz
busybox-w32-6937487be73cd4563b876413277a295a5fe2f32c.tar.bz2
busybox-w32-6937487be73cd4563b876413277a295a5fe2f32c.zip
libbb: reduce the overhead of single parameter bb_error_msg() calls
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--Config.in13
-rw-r--r--archival/bbunzip.c2
-rw-r--r--archival/bzip2.c4
-rw-r--r--archival/dpkg.c14
-rw-r--r--archival/gzip.c4
-rw-r--r--archival/libarchive/data_extract_all.c4
-rw-r--r--archival/libarchive/decompress_bunzip2.c2
-rw-r--r--archival/libarchive/decompress_gunzip.c14
-rw-r--r--archival/libarchive/decompress_uncompress.c10
-rw-r--r--archival/libarchive/decompress_unlzma.c6
-rw-r--r--archival/libarchive/decompress_unxz.c4
-rw-r--r--archival/libarchive/get_header_ar.c8
-rw-r--r--archival/libarchive/get_header_cpio.c6
-rw-r--r--archival/libarchive/get_header_tar.c14
-rw-r--r--archival/libarchive/open_transformer.c6
-rw-r--r--archival/libarchive/seek_by_jump.c2
-rw-r--r--archival/libarchive/unpack_ar_archive.c2
-rw-r--r--archival/lzop.c14
-rw-r--r--archival/rpm.c2
-rw-r--r--archival/tar.c10
-rw-r--r--archival/unzip.c18
-rw-r--r--console-tools/loadfont.c20
-rw-r--r--console-tools/loadkmap.c2
-rw-r--r--console-tools/openvt.c4
-rw-r--r--console-tools/showkey.c2
-rw-r--r--coreutils/cp.c4
-rw-r--r--coreutils/cut.c6
-rw-r--r--coreutils/date.c2
-rw-r--r--coreutils/df.c2
-rw-r--r--coreutils/echo.c2
-rw-r--r--coreutils/env.c2
-rw-r--r--coreutils/expand.c2
-rw-r--r--coreutils/expr.c16
-rw-r--r--coreutils/id.c2
-rw-r--r--coreutils/install.c2
-rw-r--r--coreutils/ln.c2
-rw-r--r--coreutils/logname.c2
-rw-r--r--coreutils/md5_sha1_sum.c2
-rw-r--r--coreutils/od_bloaty.c12
-rw-r--r--coreutils/paste.c2
-rw-r--r--coreutils/printf.c2
-rw-r--r--coreutils/rm.c2
-rw-r--r--coreutils/sort.c12
-rw-r--r--coreutils/split.c4
-rw-r--r--coreutils/stty.c6
-rw-r--r--coreutils/tail.c4
-rw-r--r--coreutils/test.c4
-rw-r--r--coreutils/tr.c4
-rw-r--r--coreutils/uudecode.c8
-rw-r--r--coreutils/uuencode.c2
-rw-r--r--debianutils/start_stop_daemon.c4
-rw-r--r--e2fsprogs/chattr.c6
-rw-r--r--e2fsprogs/fsck.c6
-rw-r--r--editors/awk.c4
-rw-r--r--editors/diff.c4
-rw-r--r--editors/ed.c34
-rw-r--r--editors/patch_bbox.c6
-rw-r--r--editors/patch_toybox.c2
-rw-r--r--editors/sed.c18
-rw-r--r--editors/vi.c2
-rw-r--r--findutils/find.c4
-rw-r--r--findutils/xargs.c4
-rw-r--r--include/libbb.h45
-rw-r--r--init/bootchartd.c2
-rw-r--r--init/init.c2
-rw-r--r--libbb/appletlib.c10
-rw-r--r--libbb/bb_getgroups.c2
-rw-r--r--libbb/bbunit.c2
-rw-r--r--libbb/capability.c2
-rw-r--r--libbb/change_identity.c2
-rw-r--r--libbb/copy_file.c2
-rw-r--r--libbb/copyfd.c6
-rw-r--r--libbb/die_if_bad_username.c2
-rw-r--r--libbb/dump.c4
-rw-r--r--libbb/fflush_stdout_and_exit.c2
-rw-r--r--libbb/get_console.c2
-rw-r--r--libbb/get_volsize.c4
-rw-r--r--libbb/getpty.c6
-rw-r--r--libbb/herror_msg.c10
-rw-r--r--libbb/mtab.c4
-rw-r--r--libbb/perror_nomsg.c4
-rw-r--r--libbb/perror_nomsg_and_die.c4
-rw-r--r--libbb/read_printf.c2
-rw-r--r--libbb/safe_poll.c2
-rw-r--r--libbb/selinux_common.c2
-rw-r--r--libbb/time.c2
-rw-r--r--libbb/update_passwd.c4
-rw-r--r--libbb/uuencode.c2
-rw-r--r--libbb/verror_msg.c15
-rw-r--r--libbb/warn_ignoring_args.c2
-rw-r--r--libbb/xconnect.c4
-rw-r--r--libbb/xfuncs.c2
-rw-r--r--libbb/xfuncs_printf.c44
-rw-r--r--libbb/xgetcwd.c2
-rw-r--r--libbb/xgethostbyname.c2
-rw-r--r--loginutils/addgroup.c2
-rw-r--r--loginutils/adduser.c4
-rw-r--r--loginutils/chpasswd.c4
-rw-r--r--loginutils/deluser.c2
-rw-r--r--loginutils/getty.c16
-rw-r--r--loginutils/login.c4
-rw-r--r--loginutils/su.c4
-rw-r--r--loginutils/sulogin.c8
-rw-r--r--mailutils/mail.c6
-rw-r--r--mailutils/popmaildir.c2
-rw-r--r--mailutils/sendmail.c2
-rw-r--r--miscutils/bc.c12
-rw-r--r--miscutils/chat.c2
-rw-r--r--miscutils/crond.c4
-rw-r--r--miscutils/crontab.c2
-rw-r--r--miscutils/dc.c4
-rw-r--r--miscutils/devfsd.c15
-rw-r--r--miscutils/devmem.c8
-rw-r--r--miscutils/fbsplash.c2
-rw-r--r--miscutils/flash_eraseall.c6
-rw-r--r--miscutils/hdparm.c12
-rw-r--r--miscutils/hexedit.c2
-rw-r--r--miscutils/i2c_tools.c44
-rw-r--r--miscutils/inotifyd.c2
-rw-r--r--miscutils/nandwrite.c10
-rw-r--r--miscutils/rfkill.c2
-rw-r--r--miscutils/rx.c6
-rw-r--r--miscutils/time.c2
-rw-r--r--miscutils/ubi_tools.c10
-rw-r--r--miscutils/ubirename.c2
-rw-r--r--modutils/modutils-24.c26
-rw-r--r--modutils/rmmod.c2
-rw-r--r--networking/arp.c36
-rw-r--r--networking/arping.c4
-rw-r--r--networking/dnsd.c8
-rw-r--r--networking/ether-wake.c4
-rw-r--r--networking/ftpgetput.c2
-rw-r--r--networking/hostname.c2
-rw-r--r--networking/httpd.c10
-rw-r--r--networking/ifconfig.c2
-rw-r--r--networking/ifplugd.c16
-rw-r--r--networking/ifupdown.c4
-rw-r--r--networking/inetd.c20
-rw-r--r--networking/ipcalc.c2
-rw-r--r--networking/isrv.c4
-rw-r--r--networking/libiproute/ipaddress.c10
-rw-r--r--networking/libiproute/ipneigh.c8
-rw-r--r--networking/libiproute/iproute.c12
-rw-r--r--networking/libiproute/iptunnel.c10
-rw-r--r--networking/libiproute/libnetlink.c30
-rw-r--r--networking/libiproute/utils.c2
-rw-r--r--networking/nbd-client.c10
-rw-r--r--networking/nc.c6
-rw-r--r--networking/nc_bloaty.c18
-rw-r--r--networking/netstat.c4
-rw-r--r--networking/nslookup.c2
-rw-r--r--networking/ntpd.c20
-rw-r--r--networking/ping.c16
-rw-r--r--networking/route.c6
-rw-r--r--networking/slattach.c4
-rw-r--r--networking/tcpudp.c6
-rw-r--r--networking/telnetd.c2
-rw-r--r--networking/tftp.c10
-rw-r--r--networking/tls.c14
-rw-r--r--networking/tls.h2
-rw-r--r--networking/traceroute.c6
-rw-r--r--networking/udhcp/arpping.c4
-rw-r--r--networking/udhcp/common.c2
-rw-r--r--networking/udhcp/common.h19
-rw-r--r--networking/udhcp/d6_dhcpc.c34
-rw-r--r--networking/udhcp/d6_packet.c4
-rw-r--r--networking/udhcp/d6_socket.c2
-rw-r--r--networking/udhcp/dhcpc.c50
-rw-r--r--networking/udhcp/dhcpd.c24
-rw-r--r--networking/udhcp/dhcprelay.c4
-rw-r--r--networking/udhcp/packet.c4
-rw-r--r--networking/udhcp/signalpipe.c2
-rw-r--r--networking/udhcp/socket.c2
-rw-r--r--networking/wget.c22
-rw-r--r--networking/zcip.c6
-rw-r--r--printutils/lpr.c12
-rw-r--r--procps/kill.c2
-rw-r--r--procps/mpstat.c2
-rw-r--r--procps/powertop.c4
-rw-r--r--procps/pstree.c2
-rw-r--r--procps/top.c2
-rw-r--r--runit/chpst.c6
-rw-r--r--runit/svlogd.c2
-rw-r--r--selinux/chcon.c4
-rw-r--r--selinux/getenforce.c4
-rw-r--r--selinux/getsebool.c2
-rw-r--r--selinux/load_policy.c2
-rw-r--r--selinux/runcon.c6
-rw-r--r--selinux/sestatus.c2
-rw-r--r--selinux/setenforce.c2
-rw-r--r--selinux/setfiles.c2
-rw-r--r--selinux/setsebool.c2
-rw-r--r--shell/hush.c32
-rw-r--r--shell/shell_common.c2
-rw-r--r--sysklogd/klogd.c2
-rw-r--r--sysklogd/logread.c2
-rw-r--r--sysklogd/syslogd.c10
-rw-r--r--util-linux/acpid.c2
-rw-r--r--util-linux/dmesg.c4
-rw-r--r--util-linux/eject.c2
-rw-r--r--util-linux/fdformat.c2
-rw-r--r--util-linux/fdisk.c2
-rw-r--r--util-linux/flock.c2
-rw-r--r--util-linux/fsck_minix.c2
-rw-r--r--util-linux/getopt.c6
-rw-r--r--util-linux/hwclock.c4
-rw-r--r--util-linux/ipcs.c8
-rw-r--r--util-linux/last.c2
-rw-r--r--util-linux/losetup.c4
-rw-r--r--util-linux/mdev.c10
-rw-r--r--util-linux/mesg.c2
-rw-r--r--util-linux/mkfs_ext2.c6
-rw-r--r--util-linux/mkfs_minix.c22
-rw-r--r--util-linux/mkfs_reiser.c2
-rw-r--r--util-linux/mkfs_vfat.c6
-rw-r--r--util-linux/mkswap.c2
-rw-r--r--util-linux/mount.c40
-rw-r--r--util-linux/nsenter.c2
-rw-r--r--util-linux/rdate.c6
-rw-r--r--util-linux/readprofile.c4
-rw-r--r--util-linux/rtcwake.c2
-rw-r--r--util-linux/setpriv.c8
-rw-r--r--util-linux/switch_root.c6
-rw-r--r--util-linux/uevent.c4
-rw-r--r--util-linux/unshare.c2
225 files changed, 845 insertions, 736 deletions
diff --git a/Config.in b/Config.in
index 1a726f043..14f54aacc 100644
--- a/Config.in
+++ b/Config.in
@@ -661,6 +661,19 @@ config WERROR
661 661
662 Most people should answer N. 662 Most people should answer N.
663 663
664config WARN_SIMPLE_MSG
665 bool "Warn about single parameter bb_xx_msg calls"
666 default n
667 help
668 This will cause warnings to be shown for any instances of
669 bb_error_msg(), bb_error_msg_and_die(), bb_perror_msg(),
670 bb_perror_msg_and_die(), bb_herror_msg() or bb_herror_msg_and_die()
671 being called with a single parameter. In these cases the equivalent
672 bb_simple_xx_msg function should be used instead.
673 Note that use of STRERROR_FMT may give false positives.
674
675 If you aren't developing busybox, say N here.
676
664choice 677choice
665 prompt "Additional debugging library" 678 prompt "Additional debugging library"
666 default NO_DEBUG_LIB 679 default NO_DEBUG_LIB
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 93f30d324..d31aaf7f3 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -114,7 +114,7 @@ int FAST_FUNC bbunpack(char **argv,
114 114
115 /* Check that the input is sane */ 115 /* Check that the input is sane */
116 if (!(option_mask32 & BBUNPK_OPT_FORCE) && isatty(STDIN_FILENO)) { 116 if (!(option_mask32 & BBUNPK_OPT_FORCE) && isatty(STDIN_FILENO)) {
117 bb_error_msg_and_die("compressed data not read from terminal, " 117 bb_simple_error_msg_and_die("compressed data not read from terminal, "
118 "use -f to force it"); 118 "use -f to force it");
119 } 119 }
120 120
diff --git a/archival/bzip2.c b/archival/bzip2.c
index 38cc0219a..d0390a92a 100644
--- a/archival/bzip2.c
+++ b/archival/bzip2.c
@@ -145,7 +145,7 @@ IF_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, vo
145 if (n2 != n) { 145 if (n2 != n) {
146 if (n2 >= 0) 146 if (n2 >= 0)
147 errno = 0; /* prevent bogus error message */ 147 errno = 0; /* prevent bogus error message */
148 bb_perror_msg(n2 >= 0 ? "short write" : bb_msg_write_error); 148 bb_simple_perror_msg(n2 >= 0 ? "short write" : bb_msg_write_error);
149 return -1; 149 return -1;
150 } 150 }
151 } 151 }
@@ -187,7 +187,7 @@ IF_DESKTOP(long long) int FAST_FUNC compressStream(transformer_state_t *xstate U
187 while (1) { 187 while (1) {
188 count = full_read(STDIN_FILENO, rbuf, IOBUF_SIZE); 188 count = full_read(STDIN_FILENO, rbuf, IOBUF_SIZE);
189 if (count < 0) { 189 if (count < 0) {
190 bb_perror_msg(bb_msg_read_error); 190 bb_simple_perror_msg(bb_msg_read_error);
191 total = -1; 191 total = -1;
192 break; 192 break;
193 } 193 }
diff --git a/archival/dpkg.c b/archival/dpkg.c
index ddb5daf09..da77fba05 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -487,7 +487,7 @@ static void add_split_dependencies(common_node_t *parent_node, const char *whole
487 } else if (strncmp(version, ">=", offset_ch) == 0) { 487 } else if (strncmp(version, ">=", offset_ch) == 0) {
488 edge->operator = VER_MORE_EQUAL; 488 edge->operator = VER_MORE_EQUAL;
489 } else { 489 } else {
490 bb_error_msg_and_die("illegal operator"); 490 bb_simple_error_msg_and_die("illegal operator");
491 } 491 }
492 } 492 }
493 /* skip to start of version numbers */ 493 /* skip to start of version numbers */
@@ -730,7 +730,7 @@ static void set_status(const unsigned status_node_num, const char *new_value, co
730 status = new_value_num; 730 status = new_value_num;
731 break; 731 break;
732 default: 732 default:
733 bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen"); 733 bb_simple_error_msg_and_die("DEBUG ONLY: this shouldnt happen");
734 } 734 }
735 735
736 new_status = xasprintf("%s %s %s", name_hashtable[want], name_hashtable[flag], name_hashtable[status]); 736 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)
944 /* Create a separate backfile to dpkg */ 944 /* Create a separate backfile to dpkg */
945 if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) { 945 if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
946 if (errno != ENOENT) 946 if (errno != ENOENT)
947 bb_error_msg_and_die("can't create backup status file"); 947 bb_simple_error_msg_and_die("can't create backup status file");
948 /* Its ok if renaming the status file fails because status 948 /* Its ok if renaming the status file fails because status
949 * file doesn't exist, maybe we are starting from scratch */ 949 * file doesn't exist, maybe we are starting from scratch */
950 bb_error_msg("no status file found, creating new one"); 950 bb_simple_error_msg("no status file found, creating new one");
951 } 951 }
952 952
953 xrename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status"); 953 xrename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status");
@@ -1816,7 +1816,7 @@ int dpkg_main(int argc UNUSED_PARAM, char **argv)
1816 init_archive_deb_control(archive_handle); 1816 init_archive_deb_control(archive_handle);
1817 deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list); 1817 deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list);
1818 if (deb_file[deb_count]->control_file == NULL) { 1818 if (deb_file[deb_count]->control_file == NULL) {
1819 bb_error_msg_and_die("can't extract control file"); 1819 bb_simple_error_msg_and_die("can't extract control file");
1820 } 1820 }
1821 deb_file[deb_count]->filename = xstrdup(argv[0]); 1821 deb_file[deb_count]->filename = xstrdup(argv[0]);
1822 package_num = fill_package_struct(deb_file[deb_count]->control_file); 1822 package_num = fill_package_struct(deb_file[deb_count]->control_file);
@@ -1879,13 +1879,13 @@ int dpkg_main(int argc UNUSED_PARAM, char **argv)
1879 argv++; 1879 argv++;
1880 } 1880 }
1881 if (!deb_count) 1881 if (!deb_count)
1882 bb_error_msg_and_die("no package files specified"); 1882 bb_simple_error_msg_and_die("no package files specified");
1883 deb_file[deb_count] = NULL; 1883 deb_file[deb_count] = NULL;
1884 1884
1885 /* Check that the deb file arguments are installable */ 1885 /* Check that the deb file arguments are installable */
1886 if (!(opt & OPT_force_ignore_depends)) { 1886 if (!(opt & OPT_force_ignore_depends)) {
1887 if (!check_deps(deb_file, 0 /*, deb_count*/)) { 1887 if (!check_deps(deb_file, 0 /*, deb_count*/)) {
1888 bb_error_msg_and_die("dependency check failed"); 1888 bb_simple_error_msg_and_die("dependency check failed");
1889 } 1889 }
1890 } 1890 }
1891 1891
diff --git a/archival/gzip.c b/archival/gzip.c
index 12c1df242..17341de45 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -99,7 +99,7 @@ aa: 85.1% -- replaced with aa.gz
99/* Diagnostic functions */ 99/* Diagnostic functions */
100#ifdef DEBUG 100#ifdef DEBUG
101static int verbose; 101static int verbose;
102# define Assert(cond,msg) { if (!(cond)) bb_error_msg(msg); } 102# define Assert(cond,msg) { if (!(cond)) bb_simple_error_msg(msg); }
103# define Trace(x) fprintf x 103# define Trace(x) fprintf x
104# define Tracev(x) {if (verbose) fprintf x; } 104# define Tracev(x) {if (verbose) fprintf x; }
105# define Tracevv(x) {if (verbose > 1) fprintf x; } 105# define Tracevv(x) {if (verbose > 1) fprintf x; }
@@ -787,7 +787,7 @@ static void check_match(IPos start, IPos match, int length)
787 /* check that the match is indeed a match */ 787 /* check that the match is indeed a match */
788 if (memcmp(G1.window + match, G1.window + start, length) != 0) { 788 if (memcmp(G1.window + match, G1.window + start, length) != 0) {
789 bb_error_msg(" start %d, match %d, length %d", start, match, length); 789 bb_error_msg(" start %d, match %d, length %d", start, match, length);
790 bb_error_msg("invalid match"); 790 bb_simple_error_msg("invalid match");
791 } 791 }
792 if (verbose > 1) { 792 if (verbose > 1) {
793 bb_error_msg("\\[%d,%d]", start - match, length); 793 bb_error_msg("\\[%d,%d]", start - match, length);
diff --git a/archival/libarchive/data_extract_all.c b/archival/libarchive/data_extract_all.c
index 4c95db4a6..3142405a3 100644
--- a/archival/libarchive/data_extract_all.c
+++ b/archival/libarchive/data_extract_all.c
@@ -103,7 +103,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
103 struct stat existing_sb; 103 struct stat existing_sb;
104 if (lstat(dst_name, &existing_sb) == -1) { 104 if (lstat(dst_name, &existing_sb) == -1) {
105 if (errno != ENOENT) { 105 if (errno != ENOENT) {
106 bb_perror_msg_and_die("can't stat old file"); 106 bb_simple_perror_msg_and_die("can't stat old file");
107 } 107 }
108 } 108 }
109 else if (existing_sb.st_mtime >= file_header->mtime) { 109 else if (existing_sb.st_mtime >= file_header->mtime) {
@@ -207,7 +207,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
207 } 207 }
208 break; 208 break;
209 default: 209 default:
210 bb_error_msg_and_die("unrecognized file type"); 210 bb_simple_error_msg_and_die("unrecognized file type");
211 } 211 }
212 212
213 if (!S_ISLNK(file_header->mode)) { 213 if (!S_ISLNK(file_header->mode)) {
diff --git a/archival/libarchive/decompress_bunzip2.c b/archival/libarchive/decompress_bunzip2.c
index 1f535b32a..42e2b4f88 100644
--- a/archival/libarchive/decompress_bunzip2.c
+++ b/archival/libarchive/decompress_bunzip2.c
@@ -817,7 +817,7 @@ unpack_bz2_stream(transformer_state_t *xstate)
817 break; 817 break;
818 } 818 }
819 if (bd->headerCRC != bd->totalCRC) { 819 if (bd->headerCRC != bd->totalCRC) {
820 bb_error_msg("CRC error"); 820 bb_simple_error_msg("CRC error");
821 break; 821 break;
822 } 822 }
823 823
diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
index 7f9046b82..1ddce610c 100644
--- a/archival/libarchive/decompress_gunzip.c
+++ b/archival/libarchive/decompress_gunzip.c
@@ -1012,7 +1012,7 @@ inflate_unzip_internal(STATE_PARAM transformer_state_t *xstate)
1012 error_msg = "corrupted data"; 1012 error_msg = "corrupted data";
1013 if (setjmp(error_jmp)) { 1013 if (setjmp(error_jmp)) {
1014 /* Error from deep inside zip machinery */ 1014 /* Error from deep inside zip machinery */
1015 bb_error_msg(error_msg); 1015 bb_simple_error_msg(error_msg);
1016 n = -1; 1016 n = -1;
1017 goto ret; 1017 goto ret;
1018 } 1018 }
@@ -1085,7 +1085,7 @@ static int top_up(STATE_PARAM unsigned n)
1085 bytebuffer_offset = 0; 1085 bytebuffer_offset = 0;
1086 bytebuffer_size = full_read(gunzip_src_fd, &bytebuffer[count], bytebuffer_max - count); 1086 bytebuffer_size = full_read(gunzip_src_fd, &bytebuffer[count], bytebuffer_max - count);
1087 if ((int)bytebuffer_size < 0) { 1087 if ((int)bytebuffer_size < 0) {
1088 bb_error_msg(bb_msg_read_error); 1088 bb_simple_error_msg(bb_msg_read_error);
1089 return 0; 1089 return 0;
1090 } 1090 }
1091 bytebuffer_size += count; 1091 bytebuffer_size += count;
@@ -1211,7 +1211,7 @@ unpack_gz_stream(transformer_state_t *xstate)
1211 1211
1212 if (full_read(xstate->src_fd, &magic2, 2) != 2) { 1212 if (full_read(xstate->src_fd, &magic2, 2) != 2) {
1213 bad_magic: 1213 bad_magic:
1214 bb_error_msg("invalid magic"); 1214 bb_simple_error_msg("invalid magic");
1215 return -1; 1215 return -1;
1216 } 1216 }
1217 if (magic2 == COMPRESS_MAGIC) { 1217 if (magic2 == COMPRESS_MAGIC) {
@@ -1233,7 +1233,7 @@ unpack_gz_stream(transformer_state_t *xstate)
1233 1233
1234 again: 1234 again:
1235 if (!check_header_gzip(PASS_STATE xstate)) { 1235 if (!check_header_gzip(PASS_STATE xstate)) {
1236 bb_error_msg("corrupted data"); 1236 bb_simple_error_msg("corrupted data");
1237 total = -1; 1237 total = -1;
1238 goto ret; 1238 goto ret;
1239 } 1239 }
@@ -1246,7 +1246,7 @@ unpack_gz_stream(transformer_state_t *xstate)
1246 total += n; 1246 total += n;
1247 1247
1248 if (!top_up(PASS_STATE 8)) { 1248 if (!top_up(PASS_STATE 8)) {
1249 bb_error_msg("corrupted data"); 1249 bb_simple_error_msg("corrupted data");
1250 total = -1; 1250 total = -1;
1251 goto ret; 1251 goto ret;
1252 } 1252 }
@@ -1254,7 +1254,7 @@ unpack_gz_stream(transformer_state_t *xstate)
1254 /* Validate decompression - crc */ 1254 /* Validate decompression - crc */
1255 v32 = buffer_read_le_u32(PASS_STATE_ONLY); 1255 v32 = buffer_read_le_u32(PASS_STATE_ONLY);
1256 if ((~gunzip_crc) != v32) { 1256 if ((~gunzip_crc) != v32) {
1257 bb_error_msg("crc error"); 1257 bb_simple_error_msg("crc error");
1258 total = -1; 1258 total = -1;
1259 goto ret; 1259 goto ret;
1260 } 1260 }
@@ -1262,7 +1262,7 @@ unpack_gz_stream(transformer_state_t *xstate)
1262 /* Validate decompression - size */ 1262 /* Validate decompression - size */
1263 v32 = buffer_read_le_u32(PASS_STATE_ONLY); 1263 v32 = buffer_read_le_u32(PASS_STATE_ONLY);
1264 if ((uint32_t)gunzip_bytes_out != v32) { 1264 if ((uint32_t)gunzip_bytes_out != v32) {
1265 bb_error_msg("incorrect length"); 1265 bb_simple_error_msg("incorrect length");
1266 total = -1; 1266 total = -1;
1267 } 1267 }
1268 1268
diff --git a/archival/libarchive/decompress_uncompress.c b/archival/libarchive/decompress_uncompress.c
index 1517559c6..2725a7f09 100644
--- a/archival/libarchive/decompress_uncompress.c
+++ b/archival/libarchive/decompress_uncompress.c
@@ -113,7 +113,7 @@ unpack_Z_stream(transformer_state_t *xstate)
113 /* xread isn't good here, we have to return - caller may want 113 /* xread isn't good here, we have to return - caller may want
114 * to do some cleanup (e.g. delete incomplete unpacked file etc) */ 114 * to do some cleanup (e.g. delete incomplete unpacked file etc) */
115 if (full_read(xstate->src_fd, inbuf, 1) != 1) { 115 if (full_read(xstate->src_fd, inbuf, 1) != 1) {
116 bb_error_msg("short read"); 116 bb_simple_error_msg("short read");
117 goto err; 117 goto err;
118 } 118 }
119 119
@@ -166,7 +166,7 @@ unpack_Z_stream(transformer_state_t *xstate)
166 if (insize < (int) (IBUFSIZ + 64) - IBUFSIZ) { 166 if (insize < (int) (IBUFSIZ + 64) - IBUFSIZ) {
167 rsize = safe_read(xstate->src_fd, inbuf + insize, IBUFSIZ); 167 rsize = safe_read(xstate->src_fd, inbuf + insize, IBUFSIZ);
168 if (rsize < 0) 168 if (rsize < 0)
169 bb_error_msg_and_die(bb_msg_read_error); 169 bb_simple_error_msg_and_die(bb_msg_read_error);
170 insize += rsize; 170 insize += rsize;
171 } 171 }
172 172
@@ -200,7 +200,7 @@ unpack_Z_stream(transformer_state_t *xstate)
200 200
201 if (oldcode == -1) { 201 if (oldcode == -1) {
202 if (code >= 256) 202 if (code >= 256)
203 bb_error_msg_and_die("corrupted data"); /* %ld", code); */ 203 bb_simple_error_msg_and_die("corrupted data"); /* %ld", code); */
204 oldcode = code; 204 oldcode = code;
205 finchar = (int) oldcode; 205 finchar = (int) oldcode;
206 outbuf[outpos++] = (unsigned char) finchar; 206 outbuf[outpos++] = (unsigned char) finchar;
@@ -236,7 +236,7 @@ unpack_Z_stream(transformer_state_t *xstate)
236 insize, posbits, p[-1], p[0], p[1], p[2], p[3], 236 insize, posbits, p[-1], p[0], p[1], p[2], p[3],
237 (posbits & 07)); 237 (posbits & 07));
238*/ 238*/
239 bb_error_msg("corrupted data"); 239 bb_simple_error_msg("corrupted data");
240 goto err; 240 goto err;
241 } 241 }
242 242
@@ -247,7 +247,7 @@ unpack_Z_stream(transformer_state_t *xstate)
247 /* Generate output characters in reverse order */ 247 /* Generate output characters in reverse order */
248 while (code >= 256) { 248 while (code >= 256) {
249 if (stackp <= &htabof(0)) 249 if (stackp <= &htabof(0))
250 bb_error_msg_and_die("corrupted data"); 250 bb_simple_error_msg_and_die("corrupted data");
251 *--stackp = tab_suffixof(code); 251 *--stackp = tab_suffixof(code);
252 code = tab_prefixof(code); 252 code = tab_prefixof(code);
253 } 253 }
diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c
index 668b01618..0744f231a 100644
--- a/archival/libarchive/decompress_unlzma.c
+++ b/archival/libarchive/decompress_unlzma.c
@@ -59,7 +59,7 @@ static void rc_read(rc_t *rc)
59//TODO: return -1 instead 59//TODO: return -1 instead
60//This will make unlzma delete broken unpacked file on unpack errors 60//This will make unlzma delete broken unpacked file on unpack errors
61 if (buffer_size <= 0) 61 if (buffer_size <= 0)
62 bb_error_msg_and_die("unexpected EOF"); 62 bb_simple_error_msg_and_die("unexpected EOF");
63 rc->buffer_end = RC_BUFFER + buffer_size; 63 rc->buffer_end = RC_BUFFER + buffer_size;
64 rc->ptr = RC_BUFFER; 64 rc->ptr = RC_BUFFER;
65} 65}
@@ -234,7 +234,7 @@ unpack_lzma_stream(transformer_state_t *xstate)
234 if (full_read(xstate->src_fd, &header, sizeof(header)) != sizeof(header) 234 if (full_read(xstate->src_fd, &header, sizeof(header)) != sizeof(header)
235 || header.pos >= (9 * 5 * 5) 235 || header.pos >= (9 * 5 * 5)
236 ) { 236 ) {
237 bb_error_msg("bad lzma header"); 237 bb_simple_error_msg("bad lzma header");
238 return -1; 238 return -1;
239 } 239 }
240 240
@@ -513,7 +513,7 @@ unpack_lzma_stream(transformer_state_t *xstate)
513 * potentially more detailed information). 513 * potentially more detailed information).
514 * Do not fail silently. 514 * Do not fail silently.
515 */ 515 */
516 bb_error_msg("corrupted data"); 516 bb_simple_error_msg("corrupted data");
517 total_written = -1; /* failure */ 517 total_written = -1; /* failure */
518 } 518 }
519 rc_free(rc); 519 rc_free(rc);
diff --git a/archival/libarchive/decompress_unxz.c b/archival/libarchive/decompress_unxz.c
index 8ae7a275b..f03341384 100644
--- a/archival/libarchive/decompress_unxz.c
+++ b/archival/libarchive/decompress_unxz.c
@@ -74,7 +74,7 @@ unpack_xz_stream(transformer_state_t *xstate)
74 if (iobuf.in_pos == iobuf.in_size) { 74 if (iobuf.in_pos == iobuf.in_size) {
75 int rd = safe_read(xstate->src_fd, membuf, BUFSIZ); 75 int rd = safe_read(xstate->src_fd, membuf, BUFSIZ);
76 if (rd < 0) { 76 if (rd < 0) {
77 bb_error_msg(bb_msg_read_error); 77 bb_simple_error_msg(bb_msg_read_error);
78 total = -1; 78 total = -1;
79 break; 79 break;
80 } 80 }
@@ -123,7 +123,7 @@ unpack_xz_stream(transformer_state_t *xstate)
123 continue; 123 continue;
124 } 124 }
125 if (xz_result != XZ_OK && xz_result != XZ_UNSUPPORTED_CHECK) { 125 if (xz_result != XZ_OK && xz_result != XZ_UNSUPPORTED_CHECK) {
126 bb_error_msg("corrupted data"); 126 bb_simple_error_msg("corrupted data");
127 total = -1; 127 total = -1;
128 break; 128 break;
129 } 129 }
diff --git a/archival/libarchive/get_header_ar.c b/archival/libarchive/get_header_ar.c
index 7ce9c615c..b6ecd596c 100644
--- a/archival/libarchive/get_header_ar.c
+++ b/archival/libarchive/get_header_ar.c
@@ -22,7 +22,7 @@ static unsigned read_num(char *str, int base, int len)
22 * on misformatted numbers bb_strtou returns all-ones */ 22 * on misformatted numbers bb_strtou returns all-ones */
23 err = bb_strtou(str, NULL, base); 23 err = bb_strtou(str, NULL, base);
24 if (err == -1) 24 if (err == -1)
25 bb_error_msg_and_die("invalid ar header"); 25 bb_simple_error_msg_and_die("invalid ar header");
26 return err; 26 return err;
27} 27}
28 28
@@ -53,7 +53,7 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle)
53 archive_handle->offset += 60; 53 archive_handle->offset += 60;
54 54
55 if (ar.formatted.magic[0] != '`' || ar.formatted.magic[1] != '\n') 55 if (ar.formatted.magic[0] != '`' || ar.formatted.magic[1] != '\n')
56 bb_error_msg_and_die("invalid ar header"); 56 bb_simple_error_msg_and_die("invalid ar header");
57 57
58 /* 58 /*
59 * Note that the fields MUST be read in reverse order as 59 * 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)
86 return get_header_ar(archive_handle); 86 return get_header_ar(archive_handle);
87 } 87 }
88#else 88#else
89 bb_error_msg_and_die("long filenames not supported"); 89 bb_simple_error_msg_and_die("long filenames not supported");
90#endif 90#endif
91 } 91 }
92 /* Only size is always present, the rest may be missing in 92 /* 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)
107 long_offset = read_num(&ar.formatted.name[1], 10, 107 long_offset = read_num(&ar.formatted.name[1], 10,
108 sizeof(ar.formatted.name) - 1); 108 sizeof(ar.formatted.name) - 1);
109 if (long_offset >= archive_handle->ar__long_name_size) { 109 if (long_offset >= archive_handle->ar__long_name_size) {
110 bb_error_msg_and_die("can't resolve long filename"); 110 bb_simple_error_msg_and_die("can't resolve long filename");
111 } 111 }
112 typed->name = xstrdup(archive_handle->ar__long_names + long_offset); 112 typed->name = xstrdup(archive_handle->ar__long_names + long_offset);
113 } else 113 } else
diff --git a/archival/libarchive/get_header_cpio.c b/archival/libarchive/get_header_cpio.c
index 75fc6a406..4ad174732 100644
--- a/archival/libarchive/get_header_cpio.c
+++ b/archival/libarchive/get_header_cpio.c
@@ -33,14 +33,14 @@ char FAST_FUNC get_header_cpio(archive_handle_t *archive_handle)
33 goto create_hardlinks; 33 goto create_hardlinks;
34 } 34 }
35 if (size != 110) { 35 if (size != 110) {
36 bb_error_msg_and_die("short read"); 36 bb_simple_error_msg_and_die("short read");
37 } 37 }
38 archive_handle->offset += 110; 38 archive_handle->offset += 110;
39 39
40 if (!is_prefixed_with(&cpio_header[0], "07070") 40 if (!is_prefixed_with(&cpio_header[0], "07070")
41 || (cpio_header[5] != '1' && cpio_header[5] != '2') 41 || (cpio_header[5] != '1' && cpio_header[5] != '2')
42 ) { 42 ) {
43 bb_error_msg_and_die("unsupported cpio format, use newc or crc"); 43 bb_simple_error_msg_and_die("unsupported cpio format, use newc or crc");
44 } 44 }
45 45
46 if (sscanf(cpio_header + 6, 46 if (sscanf(cpio_header + 6,
@@ -50,7 +50,7 @@ char FAST_FUNC get_header_cpio(archive_handle_t *archive_handle)
50 &inode, &mode, &uid, &gid, 50 &inode, &mode, &uid, &gid,
51 &nlink, &mtime, &size, 51 &nlink, &mtime, &size,
52 &major, &minor, &namesize) != 10) 52 &major, &minor, &namesize) != 10)
53 bb_error_msg_and_die("damaged cpio file"); 53 bb_simple_error_msg_and_die("damaged cpio file");
54 file_header->mode = mode; 54 file_header->mode = mode;
55 /* "cpio -R USER:GRP" support: */ 55 /* "cpio -R USER:GRP" support: */
56 if (archive_handle->cpio__owner.uid != (uid_t)-1L) 56 if (archive_handle->cpio__owner.uid != (uid_t)-1L)
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c
index 52fa4554a..b3131ff2d 100644
--- a/archival/libarchive/get_header_tar.c
+++ b/archival/libarchive/get_header_tar.c
@@ -32,7 +32,7 @@ static unsigned long long getOctal(char *str, int len)
32 if (*end != '\0' && *end != ' ') { 32 if (*end != '\0' && *end != ' ') {
33 int8_t first = str[0]; 33 int8_t first = str[0];
34 if (!(first & 0x80)) 34 if (!(first & 0x80))
35 bb_error_msg_and_die("corrupted octal value in tar header"); 35 bb_simple_error_msg_and_die("corrupted octal value in tar header");
36 /* 36 /*
37 * GNU tar uses "base-256 encoding" for very large numbers. 37 * GNU tar uses "base-256 encoding" for very large numbers.
38 * Encoding is binary, with highest bit always set as a marker 38 * 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
100 || errno != EINVAL 100 || errno != EINVAL
101 || *end != ' ' 101 || *end != ' '
102 ) { 102 ) {
103 bb_error_msg("malformed extended header, skipped"); 103 bb_simple_error_msg("malformed extended header, skipped");
104 // More verbose version: 104 // More verbose version:
105 //bb_error_msg("malformed extended header at %"OFF_FMT"d, skipped", 105 //bb_error_msg("malformed extended header at %"OFF_FMT"d, skipped",
106 // archive_handle->offset - (sz + len)); 106 // archive_handle->offset - (sz + len));
@@ -194,13 +194,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
194 * the very first read fails. Grrr. 194 * the very first read fails. Grrr.
195 */ 195 */
196 if (archive_handle->offset == 0) 196 if (archive_handle->offset == 0)
197 bb_error_msg("short read"); 197 bb_simple_error_msg("short read");
198 /* this merely signals end of archive, not exit(1): */ 198 /* this merely signals end of archive, not exit(1): */
199 return EXIT_FAILURE; 199 return EXIT_FAILURE;
200 } 200 }
201 if (i != 512) { 201 if (i != 512) {
202 IF_FEATURE_TAR_AUTODETECT(goto autodetect;) 202 IF_FEATURE_TAR_AUTODETECT(goto autodetect;)
203 bb_error_msg_and_die("short read"); 203 bb_simple_error_msg_and_die("short read");
204 } 204 }
205 205
206#else 206#else
@@ -243,11 +243,11 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
243 goto err; 243 goto err;
244 if (setup_unzip_on_fd(archive_handle->src_fd, /*fail_if_not_compressed:*/ 0) != 0) 244 if (setup_unzip_on_fd(archive_handle->src_fd, /*fail_if_not_compressed:*/ 0) != 0)
245 err: 245 err:
246 bb_error_msg_and_die("invalid tar magic"); 246 bb_simple_error_msg_and_die("invalid tar magic");
247 archive_handle->offset = 0; 247 archive_handle->offset = 0;
248 goto again_after_align; 248 goto again_after_align;
249#endif 249#endif
250 bb_error_msg_and_die("invalid tar magic"); 250 bb_simple_error_msg_and_die("invalid tar magic");
251 } 251 }
252 252
253 /* Do checksum on headers. 253 /* Do checksum on headers.
@@ -282,7 +282,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
282 if (sum_u != sum 282 if (sum_u != sum
283 IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum) 283 IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum)
284 ) { 284 ) {
285 bb_error_msg_and_die("invalid tar header checksum"); 285 bb_simple_error_msg_and_die("invalid tar header checksum");
286 } 286 }
287 287
288 /* GET_OCTAL trashes subsequent field, therefore we call it 288 /* GET_OCTAL trashes subsequent field, therefore we call it
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c
index a90f42a45..44715ef25 100644
--- a/archival/libarchive/open_transformer.c
+++ b/archival/libarchive/open_transformer.c
@@ -15,7 +15,7 @@ int FAST_FUNC check_signature16(transformer_state_t *xstate, unsigned magic16)
15 if (!xstate->signature_skipped) { 15 if (!xstate->signature_skipped) {
16 uint16_t magic2; 16 uint16_t magic2;
17 if (full_read(xstate->src_fd, &magic2, 2) != 2 || magic2 != magic16) { 17 if (full_read(xstate->src_fd, &magic2, 2) != 2 || magic2 != magic16) {
18 bb_error_msg("invalid magic"); 18 bb_simple_error_msg("invalid magic");
19 return -1; 19 return -1;
20 } 20 }
21 xstate->signature_skipped = 2; 21 xstate->signature_skipped = 2;
@@ -46,7 +46,7 @@ ssize_t FAST_FUNC transformer_write(transformer_state_t *xstate, const void *buf
46 } else { 46 } else {
47 nwrote = full_write(xstate->dst_fd, buf, bufsize); 47 nwrote = full_write(xstate->dst_fd, buf, bufsize);
48 if (nwrote != (ssize_t)bufsize) { 48 if (nwrote != (ssize_t)bufsize) {
49 bb_perror_msg("write"); 49 bb_simple_perror_msg("write");
50 nwrote = -1; 50 nwrote = -1;
51 goto ret; 51 goto ret;
52 } 52 }
@@ -205,7 +205,7 @@ static transformer_state_t *setup_transformer_on_fd(int fd, int fail_if_not_comp
205 205
206 /* No known magic seen */ 206 /* No known magic seen */
207 if (fail_if_not_compressed) 207 if (fail_if_not_compressed)
208 bb_error_msg_and_die("no gzip" 208 bb_simple_error_msg_and_die("no gzip"
209 IF_FEATURE_SEAMLESS_BZ2("/bzip2") 209 IF_FEATURE_SEAMLESS_BZ2("/bzip2")
210 IF_FEATURE_SEAMLESS_XZ("/xz") 210 IF_FEATURE_SEAMLESS_XZ("/xz")
211 " magic"); 211 " magic");
diff --git a/archival/libarchive/seek_by_jump.c b/archival/libarchive/seek_by_jump.c
index 232d97e53..dddaa3732 100644
--- a/archival/libarchive/seek_by_jump.c
+++ b/archival/libarchive/seek_by_jump.c
@@ -13,6 +13,6 @@ void FAST_FUNC seek_by_jump(int fd, off_t amount)
13 if (errno == ESPIPE) 13 if (errno == ESPIPE)
14 seek_by_read(fd, amount); 14 seek_by_read(fd, amount);
15 else 15 else
16 bb_perror_msg_and_die("seek failure"); 16 bb_simple_perror_msg_and_die("seek failure");
17 } 17 }
18} 18}
diff --git a/archival/libarchive/unpack_ar_archive.c b/archival/libarchive/unpack_ar_archive.c
index 4f9f89874..584c18ce8 100644
--- a/archival/libarchive/unpack_ar_archive.c
+++ b/archival/libarchive/unpack_ar_archive.c
@@ -12,7 +12,7 @@ void FAST_FUNC unpack_ar_archive(archive_handle_t *ar_archive)
12 12
13 xread(ar_archive->src_fd, magic, AR_MAGIC_LEN); 13 xread(ar_archive->src_fd, magic, AR_MAGIC_LEN);
14 if (!is_prefixed_with(magic, AR_MAGIC)) { 14 if (!is_prefixed_with(magic, AR_MAGIC)) {
15 bb_error_msg_and_die("invalid ar magic"); 15 bb_simple_error_msg_and_die("invalid ar magic");
16 } 16 }
17 ar_archive->offset += AR_MAGIC_LEN; 17 ar_archive->offset += AR_MAGIC_LEN;
18 18
diff --git a/archival/lzop.c b/archival/lzop.c
index 585632c4e..bdd21598c 100644
--- a/archival/lzop.c
+++ b/archival/lzop.c
@@ -752,7 +752,7 @@ static FAST_FUNC void lzo_check(
752 */ 752 */
753 uint32_t c = fn(init, buf, len); 753 uint32_t c = fn(init, buf, len);
754 if (c != ref) 754 if (c != ref)
755 bb_error_msg_and_die("checksum error"); 755 bb_simple_error_msg_and_die("checksum error");
756} 756}
757 757
758/**********************************************************************/ 758/**********************************************************************/
@@ -785,15 +785,15 @@ static NOINLINE int lzo_decompress(uint32_t h_flags32)
785 /* error if split file */ 785 /* error if split file */
786 if (dst_len == 0xffffffffL) 786 if (dst_len == 0xffffffffL)
787 /* should not happen - not yet implemented */ 787 /* should not happen - not yet implemented */
788 bb_error_msg_and_die("this file is a split lzop file"); 788 bb_simple_error_msg_and_die("this file is a split lzop file");
789 789
790 if (dst_len > MAX_BLOCK_SIZE) 790 if (dst_len > MAX_BLOCK_SIZE)
791 bb_error_msg_and_die("corrupted data"); 791 bb_simple_error_msg_and_die("corrupted data");
792 792
793 /* read compressed block size */ 793 /* read compressed block size */
794 src_len = read32(); 794 src_len = read32();
795 if (src_len <= 0 || src_len > dst_len) 795 if (src_len <= 0 || src_len > dst_len)
796 bb_error_msg_and_die("corrupted data"); 796 bb_simple_error_msg_and_die("corrupted data");
797 797
798 if (dst_len > block_size) { 798 if (dst_len > block_size) {
799 if (b2) { 799 if (b2) {
@@ -846,7 +846,7 @@ static NOINLINE int lzo_decompress(uint32_t h_flags32)
846 r = lzo1x_decompress_safe(b1, src_len, b2, &d /*, NULL*/); 846 r = lzo1x_decompress_safe(b1, src_len, b2, &d /*, NULL*/);
847 847
848 if (r != 0 /*LZO_E_OK*/ || dst_len != d) { 848 if (r != 0 /*LZO_E_OK*/ || dst_len != d) {
849 bb_error_msg_and_die("corrupted data"); 849 bb_simple_error_msg_and_die("corrupted data");
850 } 850 }
851 dst = b2; 851 dst = b2;
852 } else { 852 } else {
@@ -913,7 +913,7 @@ static void check_magic(void)
913 unsigned char magic[sizeof(lzop_magic)]; 913 unsigned char magic[sizeof(lzop_magic)];
914 xread(0, magic, sizeof(magic)); 914 xread(0, magic, sizeof(magic));
915 if (memcmp(magic, lzop_magic, sizeof(lzop_magic)) != 0) 915 if (memcmp(magic, lzop_magic, sizeof(lzop_magic)) != 0)
916 bb_error_msg_and_die("bad magic number"); 916 bb_simple_error_msg_and_die("bad magic number");
917} 917}
918 918
919/**********************************************************************/ 919/**********************************************************************/
@@ -1049,7 +1049,7 @@ static void lzo_set_method(header_t *h)
1049 else if (option_mask32 & OPT_8) 1049 else if (option_mask32 & OPT_8)
1050 level = 8; 1050 level = 8;
1051#else 1051#else
1052 bb_error_msg_and_die("high compression not compiled in"); 1052 bb_simple_error_msg_and_die("high compression not compiled in");
1053#endif 1053#endif
1054 } 1054 }
1055 1055
diff --git a/archival/rpm.c b/archival/rpm.c
index 95b2531e8..68afba914 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -543,7 +543,7 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
543 } 543 }
544 544
545 if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0) 545 if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0)
546 bb_error_msg_and_die("error unpacking"); 546 bb_simple_error_msg_and_die("error unpacking");
547 547
548 if (ENABLE_FEATURE_CLEAN_UP) { 548 if (ENABLE_FEATURE_CLEAN_UP) {
549 close(rpm_fd); 549 close(rpm_fd);
diff --git a/archival/tar.c b/archival/tar.c
index 3ef89fb0a..ca802f73c 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -369,7 +369,7 @@ static int writeTarHeader(struct TarBallInfo *tbInfo,
369 /* If it is larger than 100 bytes, bail out */ 369 /* If it is larger than 100 bytes, bail out */
370 if (header.linkname[sizeof(header.linkname)-1]) { 370 if (header.linkname[sizeof(header.linkname)-1]) {
371 free(lpath); 371 free(lpath);
372 bb_error_msg("names longer than "NAME_SIZE_STR" chars not supported"); 372 bb_simple_error_msg("names longer than "NAME_SIZE_STR" chars not supported");
373 return FALSE; 373 return FALSE;
374 } 374 }
375# endif 375# endif
@@ -542,7 +542,7 @@ static int FAST_FUNC writeFileToTarball(const char *fileName, struct stat *statb
542 542
543# if !ENABLE_FEATURE_TAR_GNU_EXTENSIONS 543# if !ENABLE_FEATURE_TAR_GNU_EXTENSIONS
544 if (strlen(header_name) >= NAME_SIZE) { 544 if (strlen(header_name) >= NAME_SIZE) {
545 bb_error_msg("names longer than "NAME_SIZE_STR" chars not supported"); 545 bb_simple_error_msg("names longer than "NAME_SIZE_STR" chars not supported");
546 return TRUE; 546 return TRUE;
547 } 547 }
548# endif 548# endif
@@ -715,13 +715,13 @@ static NOINLINE int writeTarFile(
715 freeHardLinkInfo(&tbInfo->hlInfoHead); 715 freeHardLinkInfo(&tbInfo->hlInfoHead);
716 716
717 if (errorFlag) 717 if (errorFlag)
718 bb_error_msg("error exit delayed from previous errors"); 718 bb_simple_error_msg("error exit delayed from previous errors");
719 719
720# if SEAMLESS_COMPRESSION 720# if SEAMLESS_COMPRESSION
721 if (gzip) { 721 if (gzip) {
722 int status; 722 int status;
723 if (safe_waitpid(-1, &status, 0) == -1) 723 if (safe_waitpid(-1, &status, 0) == -1)
724 bb_perror_msg("waitpid"); 724 bb_simple_perror_msg("waitpid");
725 else if (!WIFEXITED(status) || WEXITSTATUS(status)) 725 else if (!WIFEXITED(status) || WEXITSTATUS(status))
726 /* gzip was killed or has exited with nonzero! */ 726 /* gzip was killed or has exited with nonzero! */
727 errorFlag = TRUE; 727 errorFlag = TRUE;
@@ -1150,7 +1150,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1150 if (opt & OPT_CREATE) { 1150 if (opt & OPT_CREATE) {
1151 /* Make sure there is at least one file to tar up */ 1151 /* Make sure there is at least one file to tar up */
1152 if (tar_handle->accept == NULL) 1152 if (tar_handle->accept == NULL)
1153 bb_error_msg_and_die("empty archive"); 1153 bb_simple_error_msg_and_die("empty archive");
1154 1154
1155 tar_fd = STDOUT_FILENO; 1155 tar_fd = STDOUT_FILENO;
1156 /* Mimicking GNU tar 1.15.1: */ 1156 /* Mimicking GNU tar 1.15.1: */
diff --git a/archival/unzip.c b/archival/unzip.c
index 466794031..8c4cb9881 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -322,7 +322,7 @@ static uint32_t read_next_cdf(uint32_t cdf_offset, cdf_header_t *cdf)
322static void die_if_bad_fnamesize(unsigned sz) 322static void die_if_bad_fnamesize(unsigned sz)
323{ 323{
324 if (sz > 0xfff) /* more than 4k?! no funny business please */ 324 if (sz > 0xfff) /* more than 4k?! no funny business please */
325 bb_error_msg_and_die("bad archive"); 325 bb_simple_error_msg_and_die("bad archive");
326} 326}
327 327
328static void unzip_skip(off_t skip) 328static void unzip_skip(off_t skip)
@@ -359,7 +359,7 @@ static void unzip_extract_symlink(llist_t **symlink_placeholders,
359 xread(zip_fd, target, zip->fmt.ucmpsize); 359 xread(zip_fd, target, zip->fmt.ucmpsize);
360 } else { 360 } else {
361#if 1 361#if 1
362 bb_error_msg_and_die("compressed symlink is not supported"); 362 bb_simple_error_msg_and_die("compressed symlink is not supported");
363#else 363#else
364 transformer_state_t xstate; 364 transformer_state_t xstate;
365 init_transformer_state(&xstate); 365 init_transformer_state(&xstate);
@@ -399,10 +399,10 @@ static void unzip_extract(zip_header_t *zip, int dst_fd)
399 if (zip->fmt.method == 8) { 399 if (zip->fmt.method == 8) {
400 /* Method 8 - inflate */ 400 /* Method 8 - inflate */
401 if (inflate_unzip(&xstate) < 0) 401 if (inflate_unzip(&xstate) < 0)
402 bb_error_msg_and_die("inflate error"); 402 bb_simple_error_msg_and_die("inflate error");
403 /* Validate decompression - crc */ 403 /* Validate decompression - crc */
404 if (zip->fmt.crc32 != (xstate.crc32 ^ 0xffffffffL)) { 404 if (zip->fmt.crc32 != (xstate.crc32 ^ 0xffffffffL)) {
405 bb_error_msg_and_die("crc error"); 405 bb_simple_error_msg_and_die("crc error");
406 } 406 }
407 } 407 }
408#if ENABLE_FEATURE_UNZIP_BZIP2 408#if ENABLE_FEATURE_UNZIP_BZIP2
@@ -412,7 +412,7 @@ static void unzip_extract(zip_header_t *zip, int dst_fd)
412 */ 412 */
413 xstate.bytes_out = unpack_bz2_stream(&xstate); 413 xstate.bytes_out = unpack_bz2_stream(&xstate);
414 if (xstate.bytes_out < 0) 414 if (xstate.bytes_out < 0)
415 bb_error_msg_and_die("inflate error"); 415 bb_simple_error_msg_and_die("inflate error");
416 } 416 }
417#endif 417#endif
418#if ENABLE_FEATURE_UNZIP_LZMA 418#if ENABLE_FEATURE_UNZIP_LZMA
@@ -420,7 +420,7 @@ static void unzip_extract(zip_header_t *zip, int dst_fd)
420 /* Not tested yet */ 420 /* Not tested yet */
421 xstate.bytes_out = unpack_lzma_stream(&xstate); 421 xstate.bytes_out = unpack_lzma_stream(&xstate);
422 if (xstate.bytes_out < 0) 422 if (xstate.bytes_out < 0)
423 bb_error_msg_and_die("inflate error"); 423 bb_simple_error_msg_and_die("inflate error");
424 } 424 }
425#endif 425#endif
426#if ENABLE_FEATURE_UNZIP_XZ 426#if ENABLE_FEATURE_UNZIP_XZ
@@ -428,7 +428,7 @@ static void unzip_extract(zip_header_t *zip, int dst_fd)
428 /* Not tested yet */ 428 /* Not tested yet */
429 xstate.bytes_out = unpack_xz_stream(&xstate); 429 xstate.bytes_out = unpack_xz_stream(&xstate);
430 if (xstate.bytes_out < 0) 430 if (xstate.bytes_out < 0)
431 bb_error_msg_and_die("inflate error"); 431 bb_simple_error_msg_and_die("inflate error");
432 } 432 }
433#endif 433#endif
434 else { 434 else {
@@ -439,7 +439,7 @@ static void unzip_extract(zip_header_t *zip, int dst_fd)
439 if (zip->fmt.ucmpsize != xstate.bytes_out) { 439 if (zip->fmt.ucmpsize != xstate.bytes_out) {
440 /* Don't die. Who knows, maybe len calculation 440 /* Don't die. Who knows, maybe len calculation
441 * was botched somewhere. After all, crc matched! */ 441 * was botched somewhere. After all, crc matched! */
442 bb_error_msg("bad length"); 442 bb_simple_error_msg("bad length");
443 } 443 }
444} 444}
445 445
@@ -447,7 +447,7 @@ static void my_fgets80(char *buf80)
447{ 447{
448 fflush_all(); 448 fflush_all();
449 if (!fgets(buf80, 80, stdin)) { 449 if (!fgets(buf80, 80, stdin)) {
450 bb_perror_msg_and_die("can't read standard input"); 450 bb_simple_perror_msg_and_die("can't read standard input");
451 } 451 }
452} 452}
453 453
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index b5d4e8f43..caad7d9ac 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -225,7 +225,7 @@ static void do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize,
225 if (unicode == PSF2_SEPARATOR) { 225 if (unicode == PSF2_SEPARATOR) {
226 break; 226 break;
227 } else if (unicode == PSF2_STARTSEQ) { 227 } else if (unicode == PSF2_STARTSEQ) {
228 bb_error_msg_and_die("unicode sequences not implemented"); 228 bb_simple_error_msg_and_die("unicode sequences not implemented");
229 } else if (unicode >= 0xC0) { 229 } else if (unicode >= 0xC0) {
230 if (unicode >= 0xFC) 230 if (unicode >= 0xFC)
231 unicode &= 0x01, maxct = 5; 231 unicode &= 0x01, maxct = 5;
@@ -239,12 +239,12 @@ static void do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize,
239 unicode &= 0x1F, maxct = 1; 239 unicode &= 0x1F, maxct = 1;
240 do { 240 do {
241 if (tailsz <= 0 || *inbuf < 0x80 || *inbuf > 0xBF) 241 if (tailsz <= 0 || *inbuf < 0x80 || *inbuf > 0xBF)
242 bb_error_msg_and_die("illegal UTF-8 character"); 242 bb_simple_error_msg_and_die("illegal UTF-8 character");
243 --tailsz; 243 --tailsz;
244 unicode = (unicode << 6) + (*inbuf++ & 0x3F); 244 unicode = (unicode << 6) + (*inbuf++ & 0x3F);
245 } while (--maxct > 0); 245 } while (--maxct > 0);
246 } else if (unicode >= 0x80) { 246 } else if (unicode >= 0x80) {
247 bb_error_msg_and_die("illegal UTF-8 character"); 247 bb_simple_error_msg_and_die("illegal UTF-8 character");
248 } 248 }
249#else 249#else
250 return; 250 return;
@@ -281,7 +281,7 @@ static void do_load(int fd, unsigned char *buffer, size_t len)
281 281
282 if (len >= sizeof(struct psf1_header) && PSF1_MAGIC_OK(psf1h(buffer))) { 282 if (len >= sizeof(struct psf1_header) && PSF1_MAGIC_OK(psf1h(buffer))) {
283 if (psf1h(buffer)->mode > PSF1_MAXMODE) 283 if (psf1h(buffer)->mode > PSF1_MAXMODE)
284 bb_error_msg_and_die("unsupported psf file mode"); 284 bb_simple_error_msg_and_die("unsupported psf file mode");
285 if (psf1h(buffer)->mode & PSF1_MODE512) 285 if (psf1h(buffer)->mode & PSF1_MODE512)
286 fontsize = 512; 286 fontsize = 512;
287 if (psf1h(buffer)->mode & PSF1_MODEHASTAB) 287 if (psf1h(buffer)->mode & PSF1_MODEHASTAB)
@@ -292,7 +292,7 @@ static void do_load(int fd, unsigned char *buffer, size_t len)
292#if ENABLE_FEATURE_LOADFONT_PSF2 292#if ENABLE_FEATURE_LOADFONT_PSF2
293 if (len >= sizeof(struct psf2_header) && PSF2_MAGIC_OK(psf2h(buffer))) { 293 if (len >= sizeof(struct psf2_header) && PSF2_MAGIC_OK(psf2h(buffer))) {
294 if (psf2h(buffer)->version > PSF2_MAXVERSION) 294 if (psf2h(buffer)->version > PSF2_MAXVERSION)
295 bb_error_msg_and_die("unsupported psf file version"); 295 bb_simple_error_msg_and_die("unsupported psf file version");
296 fontsize = psf2h(buffer)->length; 296 fontsize = psf2h(buffer)->length;
297 if (psf2h(buffer)->flags & PSF2_HAS_UNICODE_TABLE) 297 if (psf2h(buffer)->flags & PSF2_HAS_UNICODE_TABLE)
298 has_table = 2; 298 has_table = 2;
@@ -311,19 +311,19 @@ static void do_load(int fd, unsigned char *buffer, size_t len)
311 } else 311 } else
312#endif 312#endif
313 { 313 {
314 bb_error_msg_and_die("input file: bad length or unsupported font type"); 314 bb_simple_error_msg_and_die("input file: bad length or unsupported font type");
315 } 315 }
316 316
317#if !defined(PIO_FONTX) || defined(__sparc__) 317#if !defined(PIO_FONTX) || defined(__sparc__)
318 if (fontsize != 256) 318 if (fontsize != 256)
319 bb_error_msg_and_die("only fontsize 256 supported"); 319 bb_simple_error_msg_and_die("only fontsize 256 supported");
320#endif 320#endif
321 321
322 table = font + fontsize * charsize; 322 table = font + fontsize * charsize;
323 buffer += len; 323 buffer += len;
324 324
325 if (table > buffer || (!has_table && table != buffer)) 325 if (table > buffer || (!has_table && table != buffer))
326 bb_error_msg_and_die("input file: bad length"); 326 bb_simple_error_msg_and_die("input file: bad length");
327 327
328 do_loadfont(fd, font, height, width, charsize, fontsize); 328 do_loadfont(fd, font, height, width, charsize, fontsize);
329 329
@@ -361,7 +361,7 @@ int loadfont_main(int argc UNUSED_PARAM, char **argv)
361 buffer = xmalloc_read(STDIN_FILENO, &len); 361 buffer = xmalloc_read(STDIN_FILENO, &len);
362 // xmalloc_open_zipped_read_close(filename, &len); 362 // xmalloc_open_zipped_read_close(filename, &len);
363 if (!buffer) 363 if (!buffer)
364 bb_perror_msg_and_die("error reading input font"); 364 bb_simple_perror_msg_and_die("error reading input font");
365 do_load(get_console_fd_or_die(), buffer, len); 365 do_load(get_console_fd_or_die(), buffer, len);
366 366
367 return EXIT_SUCCESS; 367 return EXIT_SUCCESS;
@@ -502,7 +502,7 @@ int setfont_main(int argc UNUSED_PARAM, char **argv)
502 if (a < 0 || a >= E_TABSZ 502 if (a < 0 || a >= E_TABSZ
503 || b < 0 || b > 65535 503 || b < 0 || b > 65535
504 ) { 504 ) {
505 bb_error_msg_and_die("map format"); 505 bb_simple_error_msg_and_die("map format");
506 } 506 }
507 // patch map 507 // patch map
508 unicodes[a] = b; 508 unicodes[a] = b;
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c
index d4981ad21..91ef50884 100644
--- a/console-tools/loadkmap.c
+++ b/console-tools/loadkmap.c
@@ -69,7 +69,7 @@ int loadkmap_main(int argc UNUSED_PARAM, char **argv)
69 69
70 xread(STDIN_FILENO, flags, 7); 70 xread(STDIN_FILENO, flags, 7);
71 if (!is_prefixed_with(flags, BINARY_KEYMAP_MAGIC)) 71 if (!is_prefixed_with(flags, BINARY_KEYMAP_MAGIC))
72 bb_error_msg_and_die("not a valid binary keymap"); 72 bb_simple_error_msg_and_die("not a valid binary keymap");
73 73
74 xread(STDIN_FILENO, flags, MAX_NR_KEYMAPS); 74 xread(STDIN_FILENO, flags, MAX_NR_KEYMAPS);
75 75
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index b01229a56..9e6cffecc 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -87,7 +87,7 @@ static int get_vt_fd(void)
87 fd = open(DEV_CONSOLE, O_RDONLY | O_NONBLOCK); 87 fd = open(DEV_CONSOLE, O_RDONLY | O_NONBLOCK);
88 if (fd >= 0 && !not_vt_fd(fd)) 88 if (fd >= 0 && !not_vt_fd(fd))
89 return fd; 89 return fd;
90 bb_error_msg_and_die("can't find open VT"); 90 bb_simple_error_msg_and_die("can't find open VT");
91} 91}
92 92
93static int find_free_vtno(void) 93static int find_free_vtno(void)
@@ -98,7 +98,7 @@ static int find_free_vtno(void)
98 errno = 0; 98 errno = 0;
99 /*xfunc_error_retval = 3; - do we need compat? */ 99 /*xfunc_error_retval = 3; - do we need compat? */
100 if (ioctl(fd, VT_OPENQRY, &vtno) != 0 || vtno <= 0) 100 if (ioctl(fd, VT_OPENQRY, &vtno) != 0 || vtno <= 0)
101 bb_perror_msg_and_die("can't find open VT"); 101 bb_simple_perror_msg_and_die("can't find open VT");
102// Not really needed, grep for DAEMON_CLOSE_EXTRA_FDS 102// Not really needed, grep for DAEMON_CLOSE_EXTRA_FDS
103// if (fd > 2) 103// if (fd > 2)
104// close(fd); 104// close(fd);
diff --git a/console-tools/showkey.c b/console-tools/showkey.c
index c322ce99d..8f0e9d938 100644
--- a/console-tools/showkey.c
+++ b/console-tools/showkey.c
@@ -56,7 +56,7 @@ static void xset1(struct termios *t)
56{ 56{
57 int ret = tcsetattr(STDIN_FILENO, TCSAFLUSH, t); 57 int ret = tcsetattr(STDIN_FILENO, TCSAFLUSH, t);
58 if (ret) { 58 if (ret) {
59 bb_perror_msg("can't tcsetattr for stdin"); 59 bb_simple_perror_msg("can't tcsetattr for stdin");
60 } 60 }
61} 61}
62 62
diff --git a/coreutils/cp.c b/coreutils/cp.c
index 59e3d2f80..cfeb19fc4 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
@@ -217,7 +217,7 @@ int cp_main(int argc, char **argv)
217 // flags, FILEUTILS_RMDEST, OPT_parents); 217 // flags, FILEUTILS_RMDEST, OPT_parents);
218 if (flags & OPT_parents) { 218 if (flags & OPT_parents) {
219 if (!(d_flags & 2)) { 219 if (!(d_flags & 2)) {
220 bb_error_msg_and_die("with --parents, the destination must be a directory"); 220 bb_simple_error_msg_and_die("with --parents, the destination must be a directory");
221 } 221 }
222 } 222 }
223 if (flags & FILEUTILS_RMDEST) { 223 if (flags & FILEUTILS_RMDEST) {
@@ -236,7 +236,7 @@ int cp_main(int argc, char **argv)
236 goto DO_COPY; /* NB: argc==2 -> *++argv==last */ 236 goto DO_COPY; /* NB: argc==2 -> *++argv==last */
237 } 237 }
238 } else if (flags & FILEUTILS_NO_TARGET_DIR) { 238 } else if (flags & FILEUTILS_NO_TARGET_DIR) {
239 bb_error_msg_and_die("too many arguments"); 239 bb_simple_error_msg_and_die("too many arguments");
240 } 240 }
241 241
242 while (1) { 242 while (1) {
diff --git a/coreutils/cut.c b/coreutils/cut.c
index e952dc17b..1acbb513e 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -209,11 +209,11 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
209// argc -= optind; 209// argc -= optind;
210 argv += optind; 210 argv += optind;
211 if (!(opt & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS))) 211 if (!(opt & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS)))
212 bb_error_msg_and_die("expected a list of bytes, characters, or fields"); 212 bb_simple_error_msg_and_die("expected a list of bytes, characters, or fields");
213 213
214 if (opt & CUT_OPT_DELIM_FLGS) { 214 if (opt & CUT_OPT_DELIM_FLGS) {
215 if (ltok[0] && ltok[1]) { /* more than 1 char? */ 215 if (ltok[0] && ltok[1]) { /* more than 1 char? */
216 bb_error_msg_and_die("the delimiter must be a single character"); 216 bb_simple_error_msg_and_die("the delimiter must be a single character");
217 } 217 }
218 delim = ltok[0]; 218 delim = ltok[0];
219 } 219 }
@@ -288,7 +288,7 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
288 288
289 /* make sure we got some cut positions out of all that */ 289 /* make sure we got some cut positions out of all that */
290 if (nlists == 0) 290 if (nlists == 0)
291 bb_error_msg_and_die("missing list of positions"); 291 bb_simple_error_msg_and_die("missing list of positions");
292 292
293 /* now that the lists are parsed, we need to sort them to make life 293 /* now that the lists are parsed, we need to sort them to make life
294 * easier on us when it comes time to print the chars / fields / lines 294 * easier on us when it comes time to print the chars / fields / lines
diff --git a/coreutils/date.c b/coreutils/date.c
index 3414d38ae..feb400430 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -304,7 +304,7 @@ int date_main(int argc UNUSED_PARAM, char **argv)
304 304
305 /* if setting time, set it */ 305 /* if setting time, set it */
306 if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { 306 if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
307 bb_perror_msg("can't set date"); 307 bb_simple_perror_msg("can't set date");
308 } 308 }
309 } 309 }
310 310
diff --git a/coreutils/df.c b/coreutils/df.c
index f6d66e4b6..debb86867 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -178,7 +178,7 @@ int df_main(int argc UNUSED_PARAM, char **argv)
178 if (!argv[0]) { 178 if (!argv[0]) {
179 mount_table = setmntent(bb_path_mtab_file, "r"); 179 mount_table = setmntent(bb_path_mtab_file, "r");
180 if (!mount_table) 180 if (!mount_table)
181 bb_perror_msg_and_die(bb_path_mtab_file); 181 bb_simple_perror_msg_and_die(bb_path_mtab_file);
182 } 182 }
183 183
184 while (1) { 184 while (1) {
diff --git a/coreutils/echo.c b/coreutils/echo.c
index 5dc5be072..b3828894c 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -188,7 +188,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv)
188 /*r =*/ full_write(STDOUT_FILENO, buffer, out - buffer); 188 /*r =*/ full_write(STDOUT_FILENO, buffer, out - buffer);
189 free(buffer); 189 free(buffer);
190 if (/*WRONG:r < 0*/ errno) { 190 if (/*WRONG:r < 0*/ errno) {
191 bb_perror_msg(bb_msg_write_error); 191 bb_simple_perror_msg(bb_msg_write_error);
192 return 1; 192 return 1;
193 } 193 }
194 return 0; 194 return 0;
diff --git a/coreutils/env.c b/coreutils/env.c
index 878068f09..c37c0c2df 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -79,7 +79,7 @@ int env_main(int argc UNUSED_PARAM, char **argv)
79 79
80 while (*argv && (strchr(*argv, '=') != NULL)) { 80 while (*argv && (strchr(*argv, '=') != NULL)) {
81 if (putenv(*argv) < 0) { 81 if (putenv(*argv) < 0) {
82 bb_perror_msg_and_die("putenv"); 82 bb_simple_perror_msg_and_die("putenv");
83 } 83 }
84 ++argv; 84 ++argv;
85 } 85 }
diff --git a/coreutils/expand.c b/coreutils/expand.c
index 20e4c4b23..4fa974df8 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -247,7 +247,7 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
247 /* Now close stdin also */ 247 /* Now close stdin also */
248 /* (if we didn't read from it, it's a no-op) */ 248 /* (if we didn't read from it, it's a no-op) */
249 if (fclose(stdin)) 249 if (fclose(stdin))
250 bb_perror_msg_and_die(bb_msg_standard_input); 250 bb_simple_perror_msg_and_die(bb_msg_standard_input);
251 251
252 fflush_stdout_and_exit(exit_status); 252 fflush_stdout_and_exit(exit_status);
253} 253}
diff --git a/coreutils/expr.c b/coreutils/expr.c
index 1bdfba004..b247f08db 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -249,7 +249,7 @@ static arith_t arithmetic_common(VALUE *l, VALUE *r, int op)
249 arith_t li, ri; 249 arith_t li, ri;
250 250
251 if (!toarith(l) || !toarith(r)) 251 if (!toarith(l) || !toarith(r))
252 bb_error_msg_and_die("non-numeric argument"); 252 bb_simple_error_msg_and_die("non-numeric argument");
253 li = l->u.i; 253 li = l->u.i;
254 ri = r->u.i; 254 ri = r->u.i;
255 if (op == '+') 255 if (op == '+')
@@ -259,7 +259,7 @@ static arith_t arithmetic_common(VALUE *l, VALUE *r, int op)
259 if (op == '*') 259 if (op == '*')
260 return li * ri; 260 return li * ri;
261 if (ri == 0) 261 if (ri == 0)
262 bb_error_msg_and_die("division by zero"); 262 bb_simple_error_msg_and_die("division by zero");
263 if (op == '/') 263 if (op == '/')
264 return li / ri; 264 return li / ri;
265 return li % ri; 265 return li % ri;
@@ -319,19 +319,19 @@ static VALUE *eval7(void)
319 VALUE *v; 319 VALUE *v;
320 320
321 if (!*G.args) 321 if (!*G.args)
322 bb_error_msg_and_die("syntax error"); 322 bb_simple_error_msg_and_die("syntax error");
323 323
324 if (nextarg("(")) { 324 if (nextarg("(")) {
325 G.args++; 325 G.args++;
326 v = eval(); 326 v = eval();
327 if (!nextarg(")")) 327 if (!nextarg(")"))
328 bb_error_msg_and_die("syntax error"); 328 bb_simple_error_msg_and_die("syntax error");
329 G.args++; 329 G.args++;
330 return v; 330 return v;
331 } 331 }
332 332
333 if (nextarg(")")) 333 if (nextarg(")"))
334 bb_error_msg_and_die("syntax error"); 334 bb_simple_error_msg_and_die("syntax error");
335 335
336 return str_value(*G.args++); 336 return str_value(*G.args++);
337} 337}
@@ -353,7 +353,7 @@ static VALUE *eval6(void)
353 G.args++; /* We have a valid token, so get the next argument. */ 353 G.args++; /* We have a valid token, so get the next argument. */
354 if (key == 1) { /* quote */ 354 if (key == 1) { /* quote */
355 if (!*G.args) 355 if (!*G.args)
356 bb_error_msg_and_die("syntax error"); 356 bb_simple_error_msg_and_die("syntax error");
357 return str_value(*G.args++); 357 return str_value(*G.args++);
358 } 358 }
359 if (key == 2) { /* length */ 359 if (key == 2) { /* length */
@@ -546,11 +546,11 @@ int expr_main(int argc UNUSED_PARAM, char **argv)
546 xfunc_error_retval = 2; /* coreutils compat */ 546 xfunc_error_retval = 2; /* coreutils compat */
547 G.args = argv + 1; 547 G.args = argv + 1;
548 if (*G.args == NULL) { 548 if (*G.args == NULL) {
549 bb_error_msg_and_die("too few arguments"); 549 bb_simple_error_msg_and_die("too few arguments");
550 } 550 }
551 v = eval(); 551 v = eval();
552 if (*G.args) 552 if (*G.args)
553 bb_error_msg_and_die("syntax error"); 553 bb_simple_error_msg_and_die("syntax error");
554 if (v->type == INTEGER) 554 if (v->type == INTEGER)
555 printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i); 555 printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i);
556 else 556 else
diff --git a/coreutils/id.c b/coreutils/id.c
index 00c0cd8ab..f20cd7d09 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -231,7 +231,7 @@ int id_main(int argc UNUSED_PARAM, char **argv)
231 } 231 }
232 } else if (n < 0) { /* error in get_groups() */ 232 } else if (n < 0) { /* error in get_groups() */
233 if (ENABLE_DESKTOP) 233 if (ENABLE_DESKTOP)
234 bb_error_msg_and_die("can't get groups"); 234 bb_simple_error_msg_and_die("can't get groups");
235 return EXIT_FAILURE; 235 return EXIT_FAILURE;
236 } 236 }
237 if (ENABLE_FEATURE_CLEAN_UP) 237 if (ENABLE_FEATURE_CLEAN_UP)
diff --git a/coreutils/install.c b/coreutils/install.c
index 8270490bd..c0f1c538a 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -238,7 +238,7 @@ int install_main(int argc, char **argv)
238 args[2] = dest; 238 args[2] = dest;
239 args[3] = NULL; 239 args[3] = NULL;
240 if (spawn_and_wait(args)) { 240 if (spawn_and_wait(args)) {
241 bb_perror_msg("strip"); 241 bb_simple_perror_msg("strip");
242 ret = EXIT_FAILURE; 242 ret = EXIT_FAILURE;
243 } 243 }
244 } 244 }
diff --git a/coreutils/ln.c b/coreutils/ln.c
index afeb0d72d..ea2d10eab 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -69,7 +69,7 @@ int ln_main(int argc, char **argv)
69 argc -= optind; 69 argc -= optind;
70 70
71 if ((opts & LN_LINKFILE) && argc > 2) { 71 if ((opts & LN_LINKFILE) && argc > 2) {
72 bb_error_msg_and_die("-T accepts 2 args max"); 72 bb_simple_error_msg_and_die("-T accepts 2 args max");
73 } 73 }
74 74
75 if (!argv[1]) { 75 if (!argv[1]) {
diff --git a/coreutils/logname.c b/coreutils/logname.c
index 31ce61f0c..06bbe1b0e 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -56,5 +56,5 @@ int logname_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
56 return fflush_all(); 56 return fflush_all();
57 } 57 }
58 58
59 bb_perror_msg_and_die("getlogin"); 59 bb_simple_perror_msg_and_die("getlogin");
60} 60}
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 538df251b..ba26c985a 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -300,7 +300,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv)
300 } 300 }
301 if (filename_ptr == NULL) { 301 if (filename_ptr == NULL) {
302 if (flags & FLAG_WARN) { 302 if (flags & FLAG_WARN) {
303 bb_error_msg("invalid format"); 303 bb_simple_error_msg("invalid format");
304 } 304 }
305 count_failed++; 305 count_failed++;
306 return_value = EXIT_FAILURE; 306 return_value = EXIT_FAILURE;
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 4cae0c529..e9c071f3a 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -536,7 +536,7 @@ check_and_close(void)
536 } 536 }
537 537
538 if (ferror(stdout)) { 538 if (ferror(stdout)) {
539 bb_error_msg_and_die(bb_msg_write_error); 539 bb_simple_error_msg_and_die(bb_msg_write_error);
540 } 540 }
541} 541}
542 542
@@ -841,7 +841,7 @@ skip(off_t n_skip)
841 } 841 }
842 842
843 if (n_skip) 843 if (n_skip)
844 bb_error_msg_and_die("can't skip past end of combined input"); 844 bb_simple_error_msg_and_die("can't skip past end of combined input");
845} 845}
846 846
847 847
@@ -1308,10 +1308,10 @@ int od_main(int argc UNUSED_PARAM, char **argv)
1308 pseudo_start = o2; 1308 pseudo_start = o2;
1309 argv[1] = NULL; 1309 argv[1] = NULL;
1310 } else { 1310 } else {
1311 bb_error_msg_and_die("the last two arguments must be offsets"); 1311 bb_simple_error_msg_and_die("the last two arguments must be offsets");
1312 } 1312 }
1313 } else { /* >3 args */ 1313 } else { /* >3 args */
1314 bb_error_msg_and_die("too many arguments"); 1314 bb_simple_error_msg_and_die("too many arguments");
1315 } 1315 }
1316 1316
1317 if (pseudo_start >= 0) { 1317 if (pseudo_start >= 0) {
@@ -1332,7 +1332,7 @@ int od_main(int argc UNUSED_PARAM, char **argv)
1332 if (option_mask32 & OPT_N) { 1332 if (option_mask32 & OPT_N) {
1333 end_offset = n_bytes_to_skip + max_bytes_to_format; 1333 end_offset = n_bytes_to_skip + max_bytes_to_format;
1334 if (end_offset < n_bytes_to_skip) 1334 if (end_offset < n_bytes_to_skip)
1335 bb_error_msg_and_die("SKIP + SIZE is too large"); 1335 bb_simple_error_msg_and_die("SKIP + SIZE is too large");
1336 } 1336 }
1337 1337
1338 if (G.n_specs == 0) { 1338 if (G.n_specs == 0) {
@@ -1389,7 +1389,7 @@ int od_main(int argc UNUSED_PARAM, char **argv)
1389 dump(n_bytes_to_skip, end_offset); 1389 dump(n_bytes_to_skip, end_offset);
1390 1390
1391 if (fclose(stdin)) 1391 if (fclose(stdin))
1392 bb_perror_msg_and_die(bb_msg_standard_input); 1392 bb_simple_perror_msg_and_die(bb_msg_standard_input);
1393 1393
1394 return G.exit_code; 1394 return G.exit_code;
1395} 1395}
diff --git a/coreutils/paste.c b/coreutils/paste.c
index 3d81a5f1a..11743297a 100644
--- a/coreutils/paste.c
+++ b/coreutils/paste.c
@@ -116,7 +116,7 @@ int paste_main(int argc UNUSED_PARAM, char **argv)
116 116
117 if (opt & PASTE_OPT_DELIMITERS) { 117 if (opt & PASTE_OPT_DELIMITERS) {
118 if (!delims[0]) 118 if (!delims[0])
119 bb_error_msg_and_die("-d '' is not supported"); 119 bb_simple_error_msg_and_die("-d '' is not supported");
120 /* unknown mappings are not changed: "\z" -> '\\' 'z' */ 120 /* unknown mappings are not changed: "\z" -> '\\' 'z' */
121 /* trailing backslash, if any, is preserved */ 121 /* trailing backslash, if any, is preserved */
122 del_cnt = strcpy_and_process_escape_sequences(delims, delims) - delims; 122 del_cnt = strcpy_and_process_escape_sequences(delims, delims) - delims;
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 5cf518699..a20fc3301 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -430,7 +430,7 @@ int printf_main(int argc UNUSED_PARAM, char **argv)
430 if (ENABLE_ASH_PRINTF 430 if (ENABLE_ASH_PRINTF
431 && applet_name[0] != 'p' 431 && applet_name[0] != 'p'
432 ) { 432 ) {
433 bb_error_msg("usage: printf FORMAT [ARGUMENT...]"); 433 bb_simple_error_msg("usage: printf FORMAT [ARGUMENT...]");
434 return 2; /* bash compat */ 434 return 2; /* bash compat */
435 } 435 }
436 bb_show_usage(); 436 bb_show_usage();
diff --git a/coreutils/rm.c b/coreutils/rm.c
index fd94bb5c4..d000129d9 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -62,7 +62,7 @@ int rm_main(int argc UNUSED_PARAM, char **argv)
62 const char *base = bb_get_last_path_component_strip(*argv); 62 const char *base = bb_get_last_path_component_strip(*argv);
63 63
64 if (DOT_OR_DOTDOT(base)) { 64 if (DOT_OR_DOTDOT(base)) {
65 bb_error_msg("can't remove '.' or '..'"); 65 bb_simple_error_msg("can't remove '.' or '..'");
66 } else if (remove_file(*argv, flags) >= 0) { 66 } else if (remove_file(*argv, flags) >= 0) {
67 continue; 67 continue;
68 } 68 }
diff --git a/coreutils/sort.c b/coreutils/sort.c
index f04c6067b..07c327645 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -277,7 +277,7 @@ static int compare_keys(const void *xarg, const void *yarg)
277 /* Perform actual comparison */ 277 /* Perform actual comparison */
278 switch (flags & (FLAG_n | FLAG_g | FLAG_M | FLAG_V)) { 278 switch (flags & (FLAG_n | FLAG_g | FLAG_M | FLAG_V)) {
279 default: 279 default:
280 bb_error_msg_and_die("unknown sort type"); 280 bb_simple_error_msg_and_die("unknown sort type");
281 break; 281 break;
282#if defined(HAVE_STRVERSCMP) && HAVE_STRVERSCMP == 1 282#if defined(HAVE_STRVERSCMP) && HAVE_STRVERSCMP == 1
283 case FLAG_V: 283 case FLAG_V:
@@ -398,10 +398,10 @@ static unsigned str2u(char **str)
398{ 398{
399 unsigned long lu; 399 unsigned long lu;
400 if (!isdigit((*str)[0])) 400 if (!isdigit((*str)[0]))
401 bb_error_msg_and_die("bad field specification"); 401 bb_simple_error_msg_and_die("bad field specification");
402 lu = strtoul(*str, str, 10); 402 lu = strtoul(*str, str, 10);
403 if ((sizeof(long) > sizeof(int) && lu > INT_MAX) || !lu) 403 if ((sizeof(long) > sizeof(int) && lu > INT_MAX) || !lu)
404 bb_error_msg_and_die("bad field specification"); 404 bb_simple_error_msg_and_die("bad field specification");
405 return lu; 405 return lu;
406} 406}
407#endif 407#endif
@@ -461,7 +461,7 @@ int sort_main(int argc UNUSED_PARAM, char **argv)
461#if ENABLE_FEATURE_SORT_BIG 461#if ENABLE_FEATURE_SORT_BIG
462 if (opts & FLAG_t) { 462 if (opts & FLAG_t) {
463 if (!str_t[0] || str_t[1]) 463 if (!str_t[0] || str_t[1])
464 bb_error_msg_and_die("bad -t parameter"); 464 bb_simple_error_msg_and_die("bad -t parameter");
465 key_separator = str_t[0]; 465 key_separator = str_t[0];
466 } 466 }
467 /* note: below this point we use option_mask32, not opts, 467 /* note: below this point we use option_mask32, not opts,
@@ -504,10 +504,10 @@ int sort_main(int argc UNUSED_PARAM, char **argv)
504 because comma isn't in OPT_STR */ 504 because comma isn't in OPT_STR */
505 idx = strchr(OPT_STR, *str_k); 505 idx = strchr(OPT_STR, *str_k);
506 if (!idx) 506 if (!idx)
507 bb_error_msg_and_die("unknown key option"); 507 bb_simple_error_msg_and_die("unknown key option");
508 flag = 1 << (idx - OPT_STR); 508 flag = 1 << (idx - OPT_STR);
509 if (flag & ~FLAG_allowed_for_k) 509 if (flag & ~FLAG_allowed_for_k)
510 bb_error_msg_and_die("unknown sort type"); 510 bb_simple_error_msg_and_die("unknown sort type");
511 /* b after ',' means strip _trailing_ space */ 511 /* b after ',' means strip _trailing_ space */
512 if (i && flag == FLAG_b) 512 if (i && flag == FLAG_b)
513 flag = FLAG_bb; 513 flag = FLAG_bb;
diff --git a/coreutils/split.c b/coreutils/split.c
index c1e4ceab2..ecbc9d2d8 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -127,7 +127,7 @@ int split_main(int argc UNUSED_PARAM, char **argv)
127 } 127 }
128 128
129 if (NAME_MAX < strlen(sfx) + suffix_len) 129 if (NAME_MAX < strlen(sfx) + suffix_len)
130 bb_error_msg_and_die("suffix too long"); 130 bb_simple_error_msg_and_die("suffix too long");
131 131
132 { 132 {
133 char *char_p = xzalloc(suffix_len + 1); 133 char *char_p = xzalloc(suffix_len + 1);
@@ -147,7 +147,7 @@ int split_main(int argc UNUSED_PARAM, char **argv)
147 do { 147 do {
148 if (!remaining) { 148 if (!remaining) {
149 if (!pfx) 149 if (!pfx)
150 bb_error_msg_and_die("suffixes exhausted"); 150 bb_simple_error_msg_and_die("suffixes exhausted");
151 xmove_fd(xopen(pfx, O_WRONLY | O_CREAT | O_TRUNC), 1); 151 xmove_fd(xopen(pfx, O_WRONLY | O_CREAT | O_TRUNC), 1);
152 pfx = next_file(pfx, suffix_len); 152 pfx = next_file(pfx, suffix_len);
153 remaining = cnt; 153 remaining = cnt;
diff --git a/coreutils/stty.c b/coreutils/stty.c
index d1309f9aa..40e812799 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -1320,7 +1320,7 @@ int stty_main(int argc UNUSED_PARAM, char **argv)
1320 break; 1320 break;
1321 case 'F': 1321 case 'F':
1322 if (file_name) 1322 if (file_name)
1323 bb_error_msg_and_die("only one device may be specified"); 1323 bb_simple_error_msg_and_die("only one device may be specified");
1324 file_name = &arg[i+1]; /* "-Fdevice" ? */ 1324 file_name = &arg[i+1]; /* "-Fdevice" ? */
1325 if (!file_name[0]) { /* nope, "-F device" */ 1325 if (!file_name[0]) { /* nope, "-F device" */
1326 int p = k+1; /* argv[p] is argnext */ 1326 int p = k+1; /* argv[p] is argnext */
@@ -1405,13 +1405,13 @@ int stty_main(int argc UNUSED_PARAM, char **argv)
1405 if ((stty_state & (STTY_verbose_output | STTY_recoverable_output)) == 1405 if ((stty_state & (STTY_verbose_output | STTY_recoverable_output)) ==
1406 (STTY_verbose_output | STTY_recoverable_output) 1406 (STTY_verbose_output | STTY_recoverable_output)
1407 ) { 1407 ) {
1408 bb_error_msg_and_die("-a and -g are mutually exclusive"); 1408 bb_simple_error_msg_and_die("-a and -g are mutually exclusive");
1409 } 1409 }
1410 /* Specifying -a or -g with non-options is an error */ 1410 /* Specifying -a or -g with non-options is an error */
1411 if ((stty_state & (STTY_verbose_output | STTY_recoverable_output)) 1411 if ((stty_state & (STTY_verbose_output | STTY_recoverable_output))
1412 && !(stty_state & STTY_noargs) 1412 && !(stty_state & STTY_noargs)
1413 ) { 1413 ) {
1414 bb_error_msg_and_die("modes may not be set when -a or -g is used"); 1414 bb_simple_error_msg_and_die("modes may not be set when -a or -g is used");
1415 } 1415 }
1416 1416
1417 /* Now it is safe to start doing things */ 1417 /* Now it is safe to start doing things */
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 14ed85d16..1f458f9ed 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -89,7 +89,7 @@ static ssize_t tail_read(int fd, char *buf, size_t count)
89 89
90 r = full_read(fd, buf, count); 90 r = full_read(fd, buf, count);
91 if (r < 0) { 91 if (r < 0) {
92 bb_perror_msg(bb_msg_read_error); 92 bb_simple_perror_msg(bb_msg_read_error);
93 G.exitcode = EXIT_FAILURE; 93 G.exitcode = EXIT_FAILURE;
94 } 94 }
95 95
@@ -186,7 +186,7 @@ int tail_main(int argc, char **argv)
186 } while (++i < argc); 186 } while (++i < argc);
187 187
188 if (!nfiles) 188 if (!nfiles)
189 bb_error_msg_and_die("no files"); 189 bb_simple_error_msg_and_die("no files");
190 190
191 /* prepare the buffer */ 191 /* prepare the buffer */
192 tailbufsize = BUFSIZ; 192 tailbufsize = BUFSIZ;
diff --git a/coreutils/test.c b/coreutils/test.c
index 8d7dac025..868ffbecb 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -832,12 +832,12 @@ int test_main(int argc, char **argv)
832 --argc; 832 --argc;
833 if (!arg0[1]) { /* "[" ? */ 833 if (!arg0[1]) { /* "[" ? */
834 if (NOT_LONE_CHAR(argv[argc], ']')) { 834 if (NOT_LONE_CHAR(argv[argc], ']')) {
835 bb_error_msg("missing ]"); 835 bb_simple_error_msg("missing ]");
836 return 2; 836 return 2;
837 } 837 }
838 } else { /* assuming "[[" */ 838 } else { /* assuming "[[" */
839 if (strcmp(argv[argc], "]]") != 0) { 839 if (strcmp(argv[argc], "]]") != 0) {
840 bb_error_msg("missing ]]"); 840 bb_simple_error_msg("missing ]]");
841 return 2; 841 return 2;
842 } 842 }
843 } 843 }
diff --git a/coreutils/tr.c b/coreutils/tr.c
index ae35a9ee3..1e402dfdb 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -308,7 +308,7 @@ int tr_main(int argc UNUSED_PARAM, char **argv)
308 str1_length = complement(str1, str1_length); 308 str1_length = complement(str1, str1_length);
309 if (*argv) { 309 if (*argv) {
310 if (argv[0][0] == '\0') 310 if (argv[0][0] == '\0')
311 bb_error_msg_and_die("STRING2 cannot be empty"); 311 bb_simple_error_msg_and_die("STRING2 cannot be empty");
312 str2_length = expand(*argv, &str2); 312 str2_length = expand(*argv, &str2);
313 map(vector, str1, str1_length, 313 map(vector, str1, str1_length,
314 str2, str2_length); 314 str2, str2_length);
@@ -333,7 +333,7 @@ int tr_main(int argc UNUSED_PARAM, char **argv)
333 read_chars = safe_read(STDIN_FILENO, str1, TR_BUFSIZ); 333 read_chars = safe_read(STDIN_FILENO, str1, TR_BUFSIZ);
334 if (read_chars <= 0) { 334 if (read_chars <= 0) {
335 if (read_chars < 0) 335 if (read_chars < 0)
336 bb_perror_msg_and_die(bb_msg_read_error); 336 bb_simple_perror_msg_and_die(bb_msg_read_error);
337 break; 337 break;
338 } 338 }
339 in_index = 0; 339 in_index = 0;
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index 5f69e62b3..dc8ef5cca 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -82,7 +82,7 @@ static void FAST_FUNC read_stduu(FILE *src_stream, FILE *dst_stream, int flags U
82 continue; 82 continue;
83 } 83 }
84 if (encoded_len > 60) { 84 if (encoded_len > 60) {
85 bb_error_msg_and_die("line too long"); 85 bb_simple_error_msg_and_die("line too long");
86 } 86 }
87 87
88 dst = line; 88 dst = line;
@@ -108,7 +108,7 @@ static void FAST_FUNC read_stduu(FILE *src_stream, FILE *dst_stream, int flags U
108 fwrite(line, 1, dst - line, dst_stream); 108 fwrite(line, 1, dst - line, dst_stream);
109 free(line); 109 free(line);
110 } 110 }
111 bb_error_msg_and_die("short file"); 111 bb_simple_error_msg_and_die("short file");
112} 112}
113#endif 113#endif
114 114
@@ -166,7 +166,7 @@ int uudecode_main(int argc UNUSED_PARAM, char **argv)
166 /* fclose_if_not_stdin(src_stream); - redundant */ 166 /* fclose_if_not_stdin(src_stream); - redundant */
167 return EXIT_SUCCESS; 167 return EXIT_SUCCESS;
168 } 168 }
169 bb_error_msg_and_die("no 'begin' line"); 169 bb_simple_error_msg_and_die("no 'begin' line");
170} 170}
171#endif 171#endif
172 172
@@ -216,7 +216,7 @@ int base64_main(int argc UNUSED_PARAM, char **argv)
216 if (!size) 216 if (!size)
217 break; 217 break;
218 if ((ssize_t)size < 0) 218 if ((ssize_t)size < 0)
219 bb_perror_msg_and_die(bb_msg_read_error); 219 bb_simple_perror_msg_and_die(bb_msg_read_error);
220 /* Encode the buffer we just read in */ 220 /* Encode the buffer we just read in */
221 bb_uuencode(dst_buf, src_buf, size, bb_uuenc_tbl_base64); 221 bb_uuencode(dst_buf, src_buf, size, bb_uuenc_tbl_base64);
222 xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3)); 222 xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3));
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c
index 2807ef82a..db49ec80a 100644
--- a/coreutils/uuencode.c
+++ b/coreutils/uuencode.c
@@ -66,7 +66,7 @@ int uuencode_main(int argc UNUSED_PARAM, char **argv)
66 if (!size) 66 if (!size)
67 break; 67 break;
68 if ((ssize_t)size < 0) 68 if ((ssize_t)size < 0)
69 bb_perror_msg_and_die(bb_msg_read_error); 69 bb_simple_perror_msg_and_die(bb_msg_read_error);
70 /* Encode the buffer we just read in */ 70 /* Encode the buffer we just read in */
71 bb_uuencode(dst_buf, src_buf, size, tbl); 71 bb_uuencode(dst_buf, src_buf, size, tbl);
72 bb_putchar('\n'); 72 bb_putchar('\n');
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 6fbf8b6de..68df44ae9 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -317,7 +317,7 @@ static void do_procinit(void)
317 } 317 }
318 closedir(procdir); 318 closedir(procdir);
319 if (!pid) 319 if (!pid)
320 bb_error_msg_and_die("nothing in /proc - not mounted?"); 320 bb_simple_error_msg_and_die("nothing in /proc - not mounted?");
321} 321}
322 322
323static int do_stop(void) 323static int do_stop(void)
@@ -337,7 +337,7 @@ static int do_stop(void)
337 } else if (userspec) { 337 } else if (userspec) {
338 what = xasprintf("process(es) owned by '%s'", userspec); 338 what = xasprintf("process(es) owned by '%s'", userspec);
339 } else { 339 } else {
340 bb_error_msg_and_die("internal error, please report"); 340 bb_simple_error_msg_and_die("internal error, please report");
341 } 341 }
342 342
343 if (!G.found_procs) { 343 if (!G.found_procs) {
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c
index c93e209b5..c37469021 100644
--- a/e2fsprogs/chattr.c
+++ b/e2fsprogs/chattr.c
@@ -196,11 +196,11 @@ int chattr_main(int argc UNUSED_PARAM, char **argv)
196 196
197 /* run sanity checks on all the arguments given us */ 197 /* run sanity checks on all the arguments given us */
198 if ((g.flags & OPT_SET) && (g.flags & (OPT_ADD|OPT_REM))) 198 if ((g.flags & OPT_SET) && (g.flags & (OPT_ADD|OPT_REM)))
199 bb_error_msg_and_die("= is incompatible with - and +"); 199 bb_simple_error_msg_and_die("= is incompatible with - and +");
200 if (g.rf & g.af) 200 if (g.rf & g.af)
201 bb_error_msg_and_die("can't set and unset a flag"); 201 bb_simple_error_msg_and_die("can't set and unset a flag");
202 if (!g.flags) 202 if (!g.flags)
203 bb_error_msg_and_die("must use '-v', =, - or +"); 203 bb_simple_error_msg_and_die("must use '-v', =, - or +");
204 204
205 /* now run chattr on all the files passed to us */ 205 /* now run chattr on all the files passed to us */
206 do change_attributes(*argv, &g); while (*++argv); 206 do change_attributes(*argv, &g); while (*++argv);
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index 8a14b3bdc..fc53a9043 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -431,10 +431,10 @@ static int wait_one(int flags)
431 if (errno == EINTR) 431 if (errno == EINTR)
432 continue; 432 continue;
433 if (errno == ECHILD) { /* paranoia */ 433 if (errno == ECHILD) { /* paranoia */
434 bb_error_msg("wait: no more children"); 434 bb_simple_error_msg("wait: no more children");
435 return -1; 435 return -1;
436 } 436 }
437 bb_perror_msg("wait"); 437 bb_simple_perror_msg("wait");
438 continue; 438 continue;
439 } 439 }
440 prev = NULL; 440 prev = NULL;
@@ -919,7 +919,7 @@ static void compile_fs_type(char *fs_type)
919 if (G.fs_type_negated == -1) 919 if (G.fs_type_negated == -1)
920 G.fs_type_negated = negate; 920 G.fs_type_negated = negate;
921 if (G.fs_type_negated != negate) 921 if (G.fs_type_negated != negate)
922 bb_error_msg_and_die( 922 bb_simple_error_msg_and_die(
923"either all or none of the filesystem types passed to -t must be prefixed " 923"either all or none of the filesystem types passed to -t must be prefixed "
924"with 'no' or '!'"); 924"with 'no' or '!'");
925 } 925 }
diff --git a/editors/awk.c b/editors/awk.c
index d25508e5d..f19990901 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -2633,7 +2633,7 @@ static var *evaluate(node *op, var *res)
2633 if (opn == '|') { 2633 if (opn == '|') {
2634 rsm->F = popen(R.s, "w"); 2634 rsm->F = popen(R.s, "w");
2635 if (rsm->F == NULL) 2635 if (rsm->F == NULL)
2636 bb_perror_msg_and_die("popen"); 2636 bb_simple_perror_msg_and_die("popen");
2637 rsm->is_pipe = 1; 2637 rsm->is_pipe = 1;
2638 } else { 2638 } else {
2639 rsm->F = xfopen(R.s, opn=='w' ? "w" : "a"); 2639 rsm->F = xfopen(R.s, opn=='w' ? "w" : "a");
@@ -3246,7 +3246,7 @@ int awk_main(int argc UNUSED_PARAM, char **argv)
3246 argv += optind; 3246 argv += optind;
3247 //argc -= optind; 3247 //argc -= optind;
3248 if (opt & OPT_W) 3248 if (opt & OPT_W)
3249 bb_error_msg("warning: option -W is ignored"); 3249 bb_simple_error_msg("warning: option -W is ignored");
3250 if (opt & OPT_F) { 3250 if (opt & OPT_F) {
3251 unescape_string_in_place(opt_F); 3251 unescape_string_in_place(opt_F);
3252 setvar_s(intvar[FS], opt_F); 3252 setvar_s(intvar[FS], opt_F);
diff --git a/editors/diff.c b/editors/diff.c
index 1462a9b18..dc40ab4f1 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -1006,7 +1006,7 @@ int diff_main(int argc UNUSED_PARAM, char **argv)
1006 xfunc_error_retval = 1; 1006 xfunc_error_retval = 1;
1007 1007
1008 if (gotstdin && (S_ISDIR(stb[0].st_mode) || S_ISDIR(stb[1].st_mode))) 1008 if (gotstdin && (S_ISDIR(stb[0].st_mode) || S_ISDIR(stb[1].st_mode)))
1009 bb_error_msg_and_die("can't compare stdin to a directory"); 1009 bb_simple_error_msg_and_die("can't compare stdin to a directory");
1010 1010
1011 /* Compare metadata to check if the files are the same physical file. 1011 /* Compare metadata to check if the files are the same physical file.
1012 * 1012 *
@@ -1037,7 +1037,7 @@ int diff_main(int argc UNUSED_PARAM, char **argv)
1037#if ENABLE_FEATURE_DIFF_DIR 1037#if ENABLE_FEATURE_DIFF_DIR
1038 diffdir(file, s_start); 1038 diffdir(file, s_start);
1039#else 1039#else
1040 bb_error_msg_and_die("no support for directory comparison"); 1040 bb_simple_error_msg_and_die("no support for directory comparison");
1041#endif 1041#endif
1042 } else { 1042 } else {
1043 bool dirfile = S_ISDIR(stb[0].st_mode) || S_ISDIR(stb[1].st_mode); 1043 bool dirfile = S_ISDIR(stb[0].st_mode) || S_ISDIR(stb[1].st_mode);
diff --git a/editors/ed.c b/editors/ed.c
index 1a36add39..d3ae8da92 100644
--- a/editors/ed.c
+++ b/editors/ed.c
@@ -165,7 +165,7 @@ static NOINLINE int searchLines(const char *str, int num1, int num2)
165 165
166 if (*str == '\0') { 166 if (*str == '\0') {
167 if (searchString[0] == '\0') { 167 if (searchString[0] == '\0') {
168 bb_error_msg("no previous search string"); 168 bb_simple_error_msg("no previous search string");
169 return 0; 169 return 0;
170 } 170 }
171 str = searchString; 171 str = searchString;
@@ -228,7 +228,7 @@ static const char* getNum(const char *cp, smallint *retHaveNum, int *retNum)
228 case '\'': 228 case '\'':
229 cp++; 229 cp++;
230 if ((unsigned)(*cp - 'a') >= 26) { 230 if ((unsigned)(*cp - 'a') >= 26) {
231 bb_error_msg("bad mark name"); 231 bb_simple_error_msg("bad mark name");
232 return NULL; 232 return NULL;
233 } 233 }
234 haveNum = TRUE; 234 haveNum = TRUE;
@@ -314,7 +314,7 @@ static int insertLine(int num, const char *data, int len)
314 LINE *newLp, *lp; 314 LINE *newLp, *lp;
315 315
316 if ((num < 1) || (num > lastNum + 1)) { 316 if ((num < 1) || (num > lastNum + 1)) {
317 bb_error_msg("inserting at bad line number"); 317 bb_simple_error_msg("inserting at bad line number");
318 return FALSE; 318 return FALSE;
319 } 319 }
320 320
@@ -384,7 +384,7 @@ static int readLines(const char *file, int num)
384 char *cp; 384 char *cp;
385 385
386 if ((num < 1) || (num > lastNum + 1)) { 386 if ((num < 1) || (num > lastNum + 1)) {
387 bb_error_msg("bad line for read"); 387 bb_simple_error_msg("bad line for read");
388 return FALSE; 388 return FALSE;
389 } 389 }
390 390
@@ -629,7 +629,7 @@ static void subCommand(const char *cmd, int num1, int num2)
629 cp = buf; 629 cp = buf;
630 630
631 if (isblank(*cp) || (*cp == '\0')) { 631 if (isblank(*cp) || (*cp == '\0')) {
632 bb_error_msg("bad delimiter for substitute"); 632 bb_simple_error_msg("bad delimiter for substitute");
633 return; 633 return;
634 } 634 }
635 635
@@ -638,7 +638,7 @@ static void subCommand(const char *cmd, int num1, int num2)
638 638
639 cp = strchr(cp, delim); 639 cp = strchr(cp, delim);
640 if (cp == NULL) { 640 if (cp == NULL) {
641 bb_error_msg("missing 2nd delimiter for substitute"); 641 bb_simple_error_msg("missing 2nd delimiter for substitute");
642 return; 642 return;
643 } 643 }
644 644
@@ -660,13 +660,13 @@ static void subCommand(const char *cmd, int num1, int num2)
660 printFlag = TRUE; 660 printFlag = TRUE;
661 break; 661 break;
662 default: 662 default:
663 bb_error_msg("unknown option for substitute"); 663 bb_simple_error_msg("unknown option for substitute");
664 return; 664 return;
665 } 665 }
666 666
667 if (*oldStr == '\0') { 667 if (*oldStr == '\0') {
668 if (searchString[0] == '\0') { 668 if (searchString[0] == '\0') {
669 bb_error_msg("no previous search string"); 669 bb_simple_error_msg("no previous search string");
670 return; 670 return;
671 } 671 }
672 oldStr = searchString; 672 oldStr = searchString;
@@ -846,7 +846,7 @@ static void doCommands(void)
846 846
847 case 'f': 847 case 'f':
848 if (*cp != '\0' && *cp != ' ') { 848 if (*cp != '\0' && *cp != ' ') {
849 bb_error_msg("bad file command"); 849 bb_simple_error_msg("bad file command");
850 break; 850 break;
851 } 851 }
852 cp = skip_whitespace(cp); 852 cp = skip_whitespace(cp);
@@ -870,7 +870,7 @@ static void doCommands(void)
870 case 'k': 870 case 'k':
871 cp = skip_whitespace(cp); 871 cp = skip_whitespace(cp);
872 if ((unsigned)(*cp - 'a') >= 26 || cp[1]) { 872 if ((unsigned)(*cp - 'a') >= 26 || cp[1]) {
873 bb_error_msg("bad mark name"); 873 bb_simple_error_msg("bad mark name");
874 break; 874 break;
875 } 875 }
876 marks[(unsigned)(*cp - 'a')] = num2; 876 marks[(unsigned)(*cp - 'a')] = num2;
@@ -887,7 +887,7 @@ static void doCommands(void)
887 case 'q': 887 case 'q':
888 cp = skip_whitespace(cp); 888 cp = skip_whitespace(cp);
889 if (have1 || *cp) { 889 if (have1 || *cp) {
890 bb_error_msg("bad quit command"); 890 bb_simple_error_msg("bad quit command");
891 break; 891 break;
892 } 892 }
893 if (!dirty) 893 if (!dirty)
@@ -903,12 +903,12 @@ static void doCommands(void)
903 903
904 case 'r': 904 case 'r':
905 if (*cp != '\0' && *cp != ' ') { 905 if (*cp != '\0' && *cp != ' ') {
906 bb_error_msg("bad read command"); 906 bb_simple_error_msg("bad read command");
907 break; 907 break;
908 } 908 }
909 cp = skip_whitespace(cp); 909 cp = skip_whitespace(cp);
910 if (*cp == '\0') { 910 if (*cp == '\0') {
911 bb_error_msg("no file name"); 911 bb_simple_error_msg("no file name");
912 break; 912 break;
913 } 913 }
914 if (!have1) 914 if (!have1)
@@ -925,14 +925,14 @@ static void doCommands(void)
925 925
926 case 'w': 926 case 'w':
927 if (*cp != '\0' && *cp != ' ') { 927 if (*cp != '\0' && *cp != ' ') {
928 bb_error_msg("bad write command"); 928 bb_simple_error_msg("bad write command");
929 break; 929 break;
930 } 930 }
931 cp = skip_whitespace(cp); 931 cp = skip_whitespace(cp);
932 if (*cp == '\0') { 932 if (*cp == '\0') {
933 cp = fileName; 933 cp = fileName;
934 if (!cp) { 934 if (!cp) {
935 bb_error_msg("no file name specified"); 935 bb_simple_error_msg("no file name specified");
936 break; 936 break;
937 } 937 }
938 } 938 }
@@ -960,7 +960,7 @@ static void doCommands(void)
960 960
961 case '.': 961 case '.':
962 if (have1) { 962 if (have1) {
963 bb_error_msg("no arguments allowed"); 963 bb_simple_error_msg("no arguments allowed");
964 break; 964 break;
965 } 965 }
966 printLines(curNum, curNum, FALSE); 966 printLines(curNum, curNum, FALSE);
@@ -984,7 +984,7 @@ static void doCommands(void)
984 break; 984 break;
985 985
986 default: 986 default:
987 bb_error_msg("unimplemented command"); 987 bb_simple_error_msg("unimplemented command");
988 break; 988 break;
989 } 989 }
990 } 990 }
diff --git a/editors/patch_bbox.c b/editors/patch_bbox.c
index 8e09ef488..d1f1ee2d6 100644
--- a/editors/patch_bbox.c
+++ b/editors/patch_bbox.c
@@ -30,7 +30,7 @@ static unsigned copy_lines(FILE *src_stream, FILE *dst_stream, unsigned lines_co
30 break; 30 break;
31 } 31 }
32 if (fputs(line, dst_stream) == EOF) { 32 if (fputs(line, dst_stream) == EOF) {
33 bb_perror_msg_and_die("error writing to new file"); 33 bb_simple_perror_msg_and_die("error writing to new file");
34 } 34 }
35 free(line); 35 free(line);
36 lines_count--; 36 lines_count--;
@@ -148,7 +148,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
148 148
149 new_filename = extract_filename(patch_line, patch_level, "+++ "); 149 new_filename = extract_filename(patch_line, patch_level, "+++ ");
150 if (!new_filename) { 150 if (!new_filename) {
151 bb_error_msg_and_die("invalid patch"); 151 bb_simple_error_msg_and_die("invalid patch");
152 } 152 }
153 153
154 /* Get access rights from the file to be patched */ 154 /* Get access rights from the file to be patched */
@@ -209,7 +209,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
209 /* src_beg_line will be 0 if it's a new file */ 209 /* src_beg_line will be 0 if it's a new file */
210 count = src_beg_line - src_cur_line; 210 count = src_beg_line - src_cur_line;
211 if (copy_lines(src_stream, dst_stream, count)) { 211 if (copy_lines(src_stream, dst_stream, count)) {
212 bb_error_msg_and_die("bad src file"); 212 bb_simple_error_msg_and_die("bad src file");
213 } 213 }
214 src_cur_line += count; 214 src_cur_line += count;
215 dst_cur_line += count; 215 dst_cur_line += count;
diff --git a/editors/patch_toybox.c b/editors/patch_toybox.c
index 3ffbf9084..aebab8132 100644
--- a/editors/patch_toybox.c
+++ b/editors/patch_toybox.c
@@ -200,7 +200,7 @@ int copy_tempfile(int fdin, char *name, char **tempname)
200 200
201 *tempname = xasprintf("%sXXXXXX", name); 201 *tempname = xasprintf("%sXXXXXX", name);
202 fd = mkstemp(*tempname); 202 fd = mkstemp(*tempname);
203 if(-1 == fd) bb_perror_msg_and_die("no temp file"); 203 if(-1 == fd) bb_simple_perror_msg_and_die("no temp file");
204 204
205 // Set permissions of output file 205 // Set permissions of output file
206 fstat(fdin, &statbuf); 206 fstat(fdin, &statbuf);
diff --git a/editors/sed.c b/editors/sed.c
index 57d3dda16..d3444003e 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -315,7 +315,7 @@ static int parse_regex_delim(const char *cmdstr, char **match, char **replace)
315 /* verify that the 's' or 'y' is followed by something. That something 315 /* verify that the 's' or 'y' is followed by something. That something
316 * (typically a 'slash') is now our regexp delimiter... */ 316 * (typically a 'slash') is now our regexp delimiter... */
317 if (*cmdstr == '\0') 317 if (*cmdstr == '\0')
318 bb_error_msg_and_die("bad format in substitution expression"); 318 bb_simple_error_msg_and_die("bad format in substitution expression");
319 delimiter = *cmdstr_ptr++; 319 delimiter = *cmdstr_ptr++;
320 320
321 /* save the match string */ 321 /* save the match string */
@@ -360,7 +360,7 @@ static int get_address(const char *my_str, int *linenum, regex_t ** regex)
360 } else { 360 } else {
361 *regex = G.previous_regex_ptr; 361 *regex = G.previous_regex_ptr;
362 if (!G.previous_regex_ptr) 362 if (!G.previous_regex_ptr)
363 bb_error_msg_and_die("no previous regexp"); 363 bb_simple_error_msg_and_die("no previous regexp");
364 } 364 }
365 /* Move position to next character after last delimiter */ 365 /* Move position to next character after last delimiter */
366 pos += (next+1); 366 pos += (next+1);
@@ -378,7 +378,7 @@ static int parse_file_cmd(/*sed_cmd_t *sed_cmd,*/ const char *filecmdstr, char *
378 start = skip_whitespace(filecmdstr); 378 start = skip_whitespace(filecmdstr);
379 eol = strchrnul(start, '\n'); 379 eol = strchrnul(start, '\n');
380 if (eol == start) 380 if (eol == start)
381 bb_error_msg_and_die("empty filename"); 381 bb_simple_error_msg_and_die("empty filename");
382 382
383 if (*eol) { 383 if (*eol) {
384 /* If lines glued together, put backslash back. */ 384 /* If lines glued together, put backslash back. */
@@ -468,7 +468,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char *substr)
468 goto out; 468 goto out;
469 default: 469 default:
470 dbg("s bad flags:'%s'", substr + idx); 470 dbg("s bad flags:'%s'", substr + idx);
471 bb_error_msg_and_die("bad option in substitution expression"); 471 bb_simple_error_msg_and_die("bad option in substitution expression");
472 } 472 }
473 } 473 }
474 out: 474 out:
@@ -688,7 +688,7 @@ static void add_cmd(const char *cmdstr)
688 idx--; /* if 0, trigger error check below */ 688 idx--; /* if 0, trigger error check below */
689 } 689 }
690 if (idx < 0) 690 if (idx < 0)
691 bb_error_msg_and_die("no address after comma"); 691 bb_simple_error_msg_and_die("no address after comma");
692 sed_cmd->end_line_orig = sed_cmd->end_line; 692 sed_cmd->end_line_orig = sed_cmd->end_line;
693 } 693 }
694 694
@@ -706,7 +706,7 @@ static void add_cmd(const char *cmdstr)
706 706
707 /* last part (mandatory) will be a command */ 707 /* last part (mandatory) will be a command */
708 if (!*cmdstr) 708 if (!*cmdstr)
709 bb_error_msg_and_die("missing command"); 709 bb_simple_error_msg_and_die("missing command");
710 sed_cmd->cmd = *cmdstr++; 710 sed_cmd->cmd = *cmdstr++;
711 cmdstr = parse_cmd_args(sed_cmd, cmdstr); 711 cmdstr = parse_cmd_args(sed_cmd, cmdstr);
712 712
@@ -791,7 +791,7 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p)
791 if (!current_regex) { 791 if (!current_regex) {
792 current_regex = G.previous_regex_ptr; 792 current_regex = G.previous_regex_ptr;
793 if (!current_regex) 793 if (!current_regex)
794 bb_error_msg_and_die("no previous regexp"); 794 bb_simple_error_msg_and_die("no previous regexp");
795 } 795 }
796 G.previous_regex_ptr = current_regex; 796 G.previous_regex_ptr = current_regex;
797 797
@@ -962,7 +962,7 @@ static void puts_maybe_newline(char *s, FILE *file, char *last_puts_char, char l
962 962
963 if (ferror(file)) { 963 if (ferror(file)) {
964 xfunc_error_retval = 4; /* It's what gnu sed exits with... */ 964 xfunc_error_retval = 4; /* It's what gnu sed exits with... */
965 bb_error_msg_and_die(bb_msg_write_error); 965 bb_simple_error_msg_and_die(bb_msg_write_error);
966 } 966 }
967 *last_puts_char = lpc; 967 *last_puts_char = lpc;
968} 968}
@@ -1192,7 +1192,7 @@ static void process_files(void)
1192 } 1192 }
1193 sed_cmd = sed_cmd->next; 1193 sed_cmd = sed_cmd->next;
1194 if (!sed_cmd) 1194 if (!sed_cmd)
1195 bb_error_msg_and_die("unterminated {"); 1195 bb_simple_error_msg_and_die("unterminated {");
1196 } 1196 }
1197 } 1197 }
1198 continue; 1198 continue;
diff --git a/editors/vi.c b/editors/vi.c
index 0ea547a75..f8fab7028 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1042,7 +1042,7 @@ static int readit(void) // read (maybe cursor) key from stdin
1042 goto again; 1042 goto again;
1043 go_bottom_and_clear_to_eol(); 1043 go_bottom_and_clear_to_eol();
1044 cookmode(); // terminal to "cooked" 1044 cookmode(); // terminal to "cooked"
1045 bb_error_msg_and_die("can't read user input"); 1045 bb_simple_error_msg_and_die("can't read user input");
1046 } 1046 }
1047 return c; 1047 return c;
1048} 1048}
diff --git a/findutils/find.c b/findutils/find.c
index 06ad1b39c..d6679bd08 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -1245,7 +1245,7 @@ static action*** parse_params(char **argv)
1245 * coreutils expects {} to appear only once in "-exec +" 1245 * coreutils expects {} to appear only once in "-exec +"
1246 */ 1246 */
1247 if (all_subst != 1 && ap->filelist) 1247 if (all_subst != 1 && ap->filelist)
1248 bb_error_msg_and_die("only one '{}' allowed for -exec +"); 1248 bb_simple_error_msg_and_die("only one '{}' allowed for -exec +");
1249# endif 1249# endif
1250 } 1250 }
1251#endif 1251#endif
@@ -1259,7 +1259,7 @@ static action*** parse_params(char **argv)
1259 endarg = argv; 1259 endarg = argv;
1260 while (1) { 1260 while (1) {
1261 if (!*++endarg) 1261 if (!*++endarg)
1262 bb_error_msg_and_die("unpaired '('"); 1262 bb_simple_error_msg_and_die("unpaired '('");
1263 if (LONE_CHAR(*endarg, '(')) 1263 if (LONE_CHAR(*endarg, '('))
1264 nested++; 1264 nested++;
1265 else if (LONE_CHAR(*endarg, ')') && !--nested) { 1265 else if (LONE_CHAR(*endarg, ')') && !--nested) {
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 03eafd616..726315803 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -665,7 +665,7 @@ int xargs_main(int argc UNUSED_PARAM, char **argv)
665 } 665 }
666 /* Sanity check */ 666 /* Sanity check */
667 if (n_max_chars <= 0) { 667 if (n_max_chars <= 0) {
668 bb_error_msg_and_die("can't fit single argument within argument list size limit"); 668 bb_simple_error_msg_and_die("can't fit single argument within argument list size limit");
669 } 669 }
670 670
671 buf = xzalloc(n_max_chars + 1); 671 buf = xzalloc(n_max_chars + 1);
@@ -716,7 +716,7 @@ int xargs_main(int argc UNUSED_PARAM, char **argv)
716 716
717 if (!G.args[initial_idx]) { /* not even one ARG was added? */ 717 if (!G.args[initial_idx]) { /* not even one ARG was added? */
718 if (*rem != '\0') 718 if (*rem != '\0')
719 bb_error_msg_and_die("argument line too long"); 719 bb_simple_error_msg_and_die("argument line too long");
720 if (opt & OPT_NO_EMPTY) 720 if (opt & OPT_NO_EMPTY)
721 break; 721 break;
722 } 722 }
diff --git a/include/libbb.h b/include/libbb.h
index 021100db1..111d1b790 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1137,7 +1137,7 @@ void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC;
1137({ \ 1137({ \
1138 pid_t bb__xvfork_pid = vfork(); \ 1138 pid_t bb__xvfork_pid = vfork(); \
1139 if (bb__xvfork_pid < 0) \ 1139 if (bb__xvfork_pid < 0) \
1140 bb_perror_msg_and_die("vfork"); \ 1140 bb_simple_perror_msg_and_die("vfork"); \
1141 bb__xvfork_pid; \ 1141 bb__xvfork_pid; \
1142}) 1142})
1143#if BB_MMU 1143#if BB_MMU
@@ -1324,13 +1324,17 @@ extern void (*die_func)(void);
1324void xfunc_die(void) NORETURN FAST_FUNC; 1324void xfunc_die(void) NORETURN FAST_FUNC;
1325void bb_show_usage(void) NORETURN FAST_FUNC; 1325void bb_show_usage(void) NORETURN FAST_FUNC;
1326void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; 1326void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
1327void bb_simple_error_msg(const char *s) FAST_FUNC;
1327void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; 1328void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
1329void bb_simple_error_msg_and_die(const char *s) NORETURN FAST_FUNC;
1328void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; 1330void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
1329void bb_simple_perror_msg(const char *s) FAST_FUNC; 1331void bb_simple_perror_msg(const char *s) FAST_FUNC;
1330void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; 1332void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
1331void bb_simple_perror_msg_and_die(const char *s) NORETURN FAST_FUNC; 1333void bb_simple_perror_msg_and_die(const char *s) NORETURN FAST_FUNC;
1332void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; 1334void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
1335void bb_simple_herror_msg(const char *s) FAST_FUNC;
1333void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; 1336void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
1337void bb_simple_herror_msg_and_die(const char *s) NORETURN FAST_FUNC;
1334void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC; 1338void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC;
1335void bb_perror_nomsg(void) FAST_FUNC; 1339void bb_perror_nomsg(void) FAST_FUNC;
1336void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC; 1340void 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;
1339 1343
1340#if ENABLE_FEATURE_SYSLOG_INFO 1344#if ENABLE_FEATURE_SYSLOG_INFO
1341void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; 1345void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
1346void bb_simple_info_msg(const char *s) FAST_FUNC;
1342void bb_vinfo_msg(const char *s, va_list p) FAST_FUNC; 1347void bb_vinfo_msg(const char *s, va_list p) FAST_FUNC;
1343#else 1348#else
1344#define bb_info_msg bb_error_msg 1349#define bb_info_msg bb_error_msg
1350#define bb_simple_info_msg bb_simple_error_msg
1345#define bb_vinfo_msg(s,p) bb_verror_msg(s,p,NULL) 1351#define bb_vinfo_msg(s,p) bb_verror_msg(s,p,NULL)
1346#endif 1352#endif
1347 1353
1354#if ENABLE_WARN_SIMPLE_MSG
1355/* If enabled, cause calls to bb_error_msg() et al that only take a single
1356 * parameter to generate a warning.
1357 */
1358static inline void __attribute__ ((deprecated("use bb_simple_error_msg instead")))
1359 bb_not_simple_error_msg(const char *s) { bb_simple_error_msg(s); }
1360static inline void __attribute__ ((deprecated("use bb_simple_error_msg_and_die instead"))) NORETURN
1361 bb_not_simple_error_msg_and_die(const char *s) { bb_simple_error_msg_and_die(s); }
1362static inline void __attribute__ ((deprecated("use bb_simple_perror_msg instead")))
1363 bb_not_simple_perror_msg(const char *s) { bb_simple_perror_msg(s); }
1364static inline void __attribute__ ((deprecated("use bb_simple_perror_msg_and_die instead"))) NORETURN
1365 bb_not_simple_perror_msg_and_die(const char *s) { bb_simple_perror_msg_and_die(s); }
1366static inline void __attribute__ ((deprecated("use bb_simple_herror_msg instead")))
1367 bb_not_simple_herror_msg(const char *s) { bb_simple_herror_msg(s); }
1368static inline void __attribute__ ((deprecated("use bb_simple_herror_msg_and_die instead"))) NORETURN
1369 bb_not_simple_herror_msg_and_die(const char *s) { bb_simple_herror_msg_and_die(s); }
1370static inline void __attribute__ ((deprecated("use bb_simple_info_msg instead")))
1371 bb_not_simple_info_msg(const char *s) { bb_simple_info_msg(s); }
1372/* Override bb_error_msg() and related functions with macros that will
1373 * substitute them for the equivalent bb_not_simple_error_msg() function when
1374 * they are used with only a single parameter. Macro approach inspired by
1375 * https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments and
1376 * https://gustedt.wordpress.com/2010/06/03/default-arguments-for-c99
1377 */
1378#define _ARG18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) _17
1379#define BB_MSG_KIND(...) _ARG18(__VA_ARGS__, , , , , , , , , , , , , , , , , _not_simple)
1380#define _BB_MSG(name, kind, ...) bb##kind##name(__VA_ARGS__)
1381#define BB_MSG(name, kind, ...) _BB_MSG(name, kind, __VA_ARGS__)
1382#define bb_error_msg(...) BB_MSG(_error_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
1383#define bb_error_msg_and_die(...) BB_MSG(_error_msg_and_die, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
1384#define bb_perror_msg(...) BB_MSG(_perror_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
1385#define bb_perror_msg_and_die(...) BB_MSG(_perror_msg_and_die, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
1386#define bb_herror_msg(...) BB_MSG(_herror_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
1387#define bb_herror_msg_and_die(...) BB_MSG(_herror_msg_and_die, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
1388#define bb_info_msg(...) BB_MSG(_info_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__)
1389#endif
1390
1348/* We need to export XXX_main from libbusybox 1391/* We need to export XXX_main from libbusybox
1349 * only if we build "individual" binaries 1392 * only if we build "individual" binaries
1350 */ 1393 */
diff --git a/init/bootchartd.c b/init/bootchartd.c
index 4377d90e3..750f67356 100644
--- a/init/bootchartd.c
+++ b/init/bootchartd.c
@@ -208,7 +208,7 @@ static char *make_tempdir(void)
208 bb_perror_msg_and_die("can't %smount tmpfs", "un"); 208 bb_perror_msg_and_die("can't %smount tmpfs", "un");
209 } 209 }
210#else 210#else
211 bb_perror_msg_and_die("can't create temporary directory"); 211 bb_simple_perror_msg_and_die("can't create temporary directory");
212#endif 212#endif
213 } else { 213 } else {
214 xchdir(tempdir); 214 xchdir(tempdir);
diff --git a/init/init.c b/init/init.c
index 87086b48b..0f3c5fa4d 100644
--- a/init/init.c
+++ b/init/init.c
@@ -1086,7 +1086,7 @@ int init_main(int argc UNUSED_PARAM, char **argv)
1086 if (getpid() != 1 1086 if (getpid() != 1
1087 && (!ENABLE_LINUXRC || applet_name[0] != 'l') /* not linuxrc? */ 1087 && (!ENABLE_LINUXRC || applet_name[0] != 'l') /* not linuxrc? */
1088 ) { 1088 ) {
1089 bb_error_msg_and_die("must be run as PID 1"); 1089 bb_simple_error_msg_and_die("must be run as PID 1");
1090 } 1090 }
1091#ifdef RB_DISABLE_CAD 1091#ifdef RB_DISABLE_CAD
1092 /* Turn off rebooting via CTL-ALT-DEL - we get a 1092 /* Turn off rebooting via CTL-ALT-DEL - we get a
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index fa19e8488..9fa17cfa1 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -631,7 +631,7 @@ static void check_suid(int applet_no)
631 /* same group / in group */ 631 /* same group / in group */
632 m >>= 3; 632 m >>= 3;
633 if (!(m & S_IXOTH)) /* is x bit not set? */ 633 if (!(m & S_IXOTH)) /* is x bit not set? */
634 bb_error_msg_and_die("you have no permission to run this applet"); 634 bb_simple_error_msg_and_die("you have no permission to run this applet");
635 635
636 /* We set effective AND saved ids. If saved-id is not set 636 /* We set effective AND saved ids. If saved-id is not set
637 * like we do below, seteuid(0) can still later succeed! */ 637 * like we do below, seteuid(0) can still later succeed! */
@@ -643,7 +643,7 @@ static void check_suid(int applet_no)
643 rgid = sct->m_ugid.gid; 643 rgid = sct->m_ugid.gid;
644 /* else: we will set egid = rgid, thus dropping sgid effect */ 644 /* else: we will set egid = rgid, thus dropping sgid effect */
645 if (setresgid(-1, rgid, rgid)) 645 if (setresgid(-1, rgid, rgid))
646 bb_perror_msg_and_die("setresgid"); 646 bb_simple_perror_msg_and_die("setresgid");
647 647
648 /* Are we directed to change uid 648 /* Are we directed to change uid
649 * (APPLET = s** USER.GROUP or APPLET = S** USER.GROUP)? 649 * (APPLET = s** USER.GROUP or APPLET = S** USER.GROUP)?
@@ -653,7 +653,7 @@ static void check_suid(int applet_no)
653 uid = sct->m_ugid.uid; 653 uid = sct->m_ugid.uid;
654 /* else: we will set euid = ruid, thus dropping suid effect */ 654 /* else: we will set euid = ruid, thus dropping suid effect */
655 if (setresuid(-1, uid, uid)) 655 if (setresuid(-1, uid, uid))
656 bb_perror_msg_and_die("setresuid"); 656 bb_simple_perror_msg_and_die("setresuid");
657 657
658 goto ret; 658 goto ret;
659 } 659 }
@@ -663,7 +663,7 @@ static void check_suid(int applet_no)
663 663
664 if (!onetime) { 664 if (!onetime) {
665 onetime = 1; 665 onetime = 1;
666 bb_error_msg("using fallback suid method"); 666 bb_simple_error_msg("using fallback suid method");
667 } 667 }
668 } 668 }
669# endif 669# endif
@@ -673,7 +673,7 @@ static void check_suid(int applet_no)
673 /* Real uid is not 0. If euid isn't 0 too, suid bit 673 /* Real uid is not 0. If euid isn't 0 too, suid bit
674 * is most probably not set on our executable */ 674 * is most probably not set on our executable */
675 if (geteuid()) 675 if (geteuid())
676 bb_error_msg_and_die("must be suid to work properly"); 676 bb_simple_error_msg_and_die("must be suid to work properly");
677 } else if (APPLET_SUID(applet_no) == BB_SUID_DROP) { 677 } else if (APPLET_SUID(applet_no) == BB_SUID_DROP) {
678 /* 678 /*
679 * Drop all privileges. 679 * Drop all privileges.
diff --git a/libbb/bb_getgroups.c b/libbb/bb_getgroups.c
index 59ae53738..5d83c729a 100644
--- a/libbb/bb_getgroups.c
+++ b/libbb/bb_getgroups.c
@@ -38,7 +38,7 @@ gid_t* FAST_FUNC bb_getgroups(int *ngroups, gid_t *group_array)
38 continue; 38 continue;
39 } 39 }
40 /* Some other error (should never happen on Linux) */ 40 /* Some other error (should never happen on Linux) */
41 bb_perror_msg_and_die("getgroups"); 41 bb_simple_perror_msg_and_die("getgroups");
42 } 42 }
43 43
44 if (ngroups) 44 if (ngroups)
diff --git a/libbb/bbunit.c b/libbb/bbunit.c
index 5f8d980a3..ccd909d78 100644
--- a/libbb/bbunit.c
+++ b/libbb/bbunit.c
@@ -60,6 +60,6 @@ int unit_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
60 return EXIT_FAILURE; 60 return EXIT_FAILURE;
61 } 61 }
62 62
63 bb_error_msg("All tests passed"); 63 bb_simple_error_msg("All tests passed");
64 return EXIT_SUCCESS; 64 return EXIT_SUCCESS;
65} 65}
diff --git a/libbb/capability.c b/libbb/capability.c
index d0ae78b91..23afd8eb9 100644
--- a/libbb/capability.c
+++ b/libbb/capability.c
@@ -119,7 +119,7 @@ void FAST_FUNC getcaps(void *arg)
119 caps->u32s = _LINUX_CAPABILITY_U32S_3; 119 caps->u32s = _LINUX_CAPABILITY_U32S_3;
120 break; 120 break;
121 default: 121 default:
122 bb_error_msg_and_die("unsupported capability version"); 122 bb_simple_error_msg_and_die("unsupported capability version");
123 } 123 }
124 124
125 if (capget(&caps->header, caps->data) != 0) 125 if (capget(&caps->header, caps->data) != 0)
diff --git a/libbb/change_identity.c b/libbb/change_identity.c
index 20d7c5f2d..9ff741234 100644
--- a/libbb/change_identity.c
+++ b/libbb/change_identity.c
@@ -51,7 +51,7 @@ void FAST_FUNC change_identity(const struct passwd *pw)
51 return; 51 return;
52 } 52 }
53 53
54 bb_perror_msg_and_die("can't set groups"); 54 bb_simple_perror_msg_and_die("can't set groups");
55 } 55 }
56 56
57 xsetgid(pw->pw_gid); 57 xsetgid(pw->pw_gid);
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 2d6557cd4..49d1ec9c6 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -327,7 +327,7 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
327 ) { 327 ) {
328 security_context_t con; 328 security_context_t con;
329 if (getfscreatecon(&con) == -1) { 329 if (getfscreatecon(&con) == -1) {
330 bb_perror_msg("getfscreatecon"); 330 bb_simple_perror_msg("getfscreatecon");
331 return -1; 331 return -1;
332 } 332 }
333 if (con) { 333 if (con) {
diff --git a/libbb/copyfd.c b/libbb/copyfd.c
index dd0517cd6..ae5c26999 100644
--- a/libbb/copyfd.c
+++ b/libbb/copyfd.c
@@ -87,7 +87,7 @@ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
87 rd = safe_read(src_fd, buffer, 87 rd = safe_read(src_fd, buffer,
88 size > buffer_size ? buffer_size : size); 88 size > buffer_size ? buffer_size : size);
89 if (rd < 0) { 89 if (rd < 0) {
90 bb_perror_msg(bb_msg_read_error); 90 bb_simple_perror_msg(bb_msg_read_error);
91 break; 91 break;
92 } 92 }
93 read_ok: 93 read_ok:
@@ -100,7 +100,7 @@ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
100 ssize_t wr = full_write(dst_fd, buffer, rd); 100 ssize_t wr = full_write(dst_fd, buffer, rd);
101 if (wr < rd) { 101 if (wr < rd) {
102 if (!continue_on_write_error) { 102 if (!continue_on_write_error) {
103 bb_perror_msg(bb_msg_write_error); 103 bb_simple_perror_msg(bb_msg_write_error);
104 break; 104 break;
105 } 105 }
106 dst_fd = -1; 106 dst_fd = -1;
@@ -151,7 +151,7 @@ void FAST_FUNC bb_copyfd_exact_size(int fd1, int fd2, off_t size)
151 if (sz == (size >= 0 ? size : -size)) 151 if (sz == (size >= 0 ? size : -size))
152 return; 152 return;
153 if (sz != -1) 153 if (sz != -1)
154 bb_error_msg_and_die("short read"); 154 bb_simple_error_msg_and_die("short read");
155 /* if sz == -1, bb_copyfd_XX already complained */ 155 /* if sz == -1, bb_copyfd_XX already complained */
156 xfunc_die(); 156 xfunc_die();
157} 157}
diff --git a/libbb/die_if_bad_username.c b/libbb/die_if_bad_username.c
index 46f103340..e5e1160c4 100644
--- a/libbb/die_if_bad_username.c
+++ b/libbb/die_if_bad_username.c
@@ -57,5 +57,5 @@ void FAST_FUNC die_if_bad_username(const char *name)
57 * including the terminating null byte. 57 * including the terminating null byte.
58 */ 58 */
59 if (name - start >= LOGIN_NAME_MAX) 59 if (name - start >= LOGIN_NAME_MAX)
60 bb_error_msg_and_die("name is too long"); 60 bb_simple_error_msg_and_die("name is too long");
61} 61}
diff --git a/libbb/dump.c b/libbb/dump.c
index b4b49d709..8029cca0e 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -199,7 +199,7 @@ static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs)
199 pr->bcnt = fu->bcnt; 199 pr->bcnt = fu->bcnt;
200 if (fu->bcnt == 0) { 200 if (fu->bcnt == 0) {
201 if (!prec) 201 if (!prec)
202 bb_error_msg_and_die("%%s needs precision or byte count"); 202 bb_simple_error_msg_and_die("%%s needs precision or byte count");
203 pr->bcnt = atoi(prec); 203 pr->bcnt = atoi(prec);
204 } 204 }
205 } else 205 } else
@@ -266,7 +266,7 @@ static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs)
266 266
267 /* only one conversion character if byte count */ 267 /* only one conversion character if byte count */
268 if (!(pr->flags & F_ADDRESS) && fu->bcnt && nconv++) { 268 if (!(pr->flags & F_ADDRESS) && fu->bcnt && nconv++) {
269 bb_error_msg_and_die("byte count with multiple conversion characters"); 269 bb_simple_error_msg_and_die("byte count with multiple conversion characters");
270 } 270 }
271 } 271 }
272 /* 272 /*
diff --git a/libbb/fflush_stdout_and_exit.c b/libbb/fflush_stdout_and_exit.c
index 4c689c0fb..5df74170e 100644
--- a/libbb/fflush_stdout_and_exit.c
+++ b/libbb/fflush_stdout_and_exit.c
@@ -15,7 +15,7 @@ void FAST_FUNC fflush_stdout_and_exit(int retval)
15{ 15{
16 xfunc_error_retval = retval; 16 xfunc_error_retval = retval;
17 if (fflush(stdout)) 17 if (fflush(stdout))
18 bb_perror_msg_and_die(bb_msg_standard_output); 18 bb_simple_perror_msg_and_die(bb_msg_standard_output);
19 /* In case we are in NOFORK applet. Do not exit() directly, 19 /* In case we are in NOFORK applet. Do not exit() directly,
20 * but use xfunc_die() */ 20 * but use xfunc_die() */
21 xfunc_die(); 21 xfunc_die();
diff --git a/libbb/get_console.c b/libbb/get_console.c
index 0b53524aa..7f2c75332 100644
--- a/libbb/get_console.c
+++ b/libbb/get_console.c
@@ -62,7 +62,7 @@ int FAST_FUNC get_console_fd_or_die(void)
62 } 62 }
63 } 63 }
64 64
65 bb_error_msg_and_die("can't open console"); 65 bb_simple_error_msg_and_die("can't open console");
66} 66}
67 67
68/* From <linux/vt.h> */ 68/* From <linux/vt.h> */
diff --git a/libbb/get_volsize.c b/libbb/get_volsize.c
index 241ceda9b..087efb3c7 100644
--- a/libbb/get_volsize.c
+++ b/libbb/get_volsize.c
@@ -18,7 +18,7 @@ uoff_t FAST_FUNC get_volume_size_in_bytes(int fd,
18 if (override) { 18 if (override) {
19 result = XATOOFF(override); 19 result = XATOOFF(override);
20 if (result >= (uoff_t)(MAXINT(off_t)) / override_units) 20 if (result >= (uoff_t)(MAXINT(off_t)) / override_units)
21 bb_error_msg_and_die("image size is too big"); 21 bb_simple_error_msg_and_die("image size is too big");
22 result *= override_units; 22 result *= override_units;
23 /* seek past end fails on block devices but works on files */ 23 /* seek past end fails on block devices but works on files */
24 if (lseek(fd, result - 1, SEEK_SET) != (off_t)-1) { 24 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,
42 * 42 *
43 * Picked 16k arbitrarily: */ 43 * Picked 16k arbitrarily: */
44 if (result < 16*1024) 44 if (result < 16*1024)
45 bb_error_msg_and_die("image is too small"); 45 bb_simple_error_msg_and_die("image is too small");
46 46
47 return result; 47 return result;
48} 48}
diff --git a/libbb/getpty.c b/libbb/getpty.c
index 5d24ca930..9ec6265ad 100644
--- a/libbb/getpty.c
+++ b/libbb/getpty.c
@@ -23,14 +23,14 @@ int FAST_FUNC xgetpty(char *line)
23 const char *name; 23 const char *name;
24 name = ptsname(p); /* find out the name of slave pty */ 24 name = ptsname(p); /* find out the name of slave pty */
25 if (!name) { 25 if (!name) {
26 bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); 26 bb_simple_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
27 } 27 }
28 safe_strncpy(line, name, GETPTY_BUFSIZE); 28 safe_strncpy(line, name, GETPTY_BUFSIZE);
29 } 29 }
30# else 30# else
31 /* find out the name of slave pty */ 31 /* find out the name of slave pty */
32 if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) { 32 if (ptsname_r(p, line, GETPTY_BUFSIZE-1) != 0) {
33 bb_perror_msg_and_die("ptsname error (is /dev/pts mounted?)"); 33 bb_simple_perror_msg_and_die("ptsname error (is /dev/pts mounted?)");
34 } 34 }
35 line[GETPTY_BUFSIZE-1] = '\0'; 35 line[GETPTY_BUFSIZE-1] = '\0';
36# endif 36# endif
@@ -61,5 +61,5 @@ int FAST_FUNC xgetpty(char *line)
61 } 61 }
62 } 62 }
63#endif /* FEATURE_DEVPTS */ 63#endif /* FEATURE_DEVPTS */
64 bb_error_msg_and_die("can't find free pty"); 64 bb_simple_error_msg_and_die("can't find free pty");
65} 65}
diff --git a/libbb/herror_msg.c b/libbb/herror_msg.c
index d041076e0..a7dd98679 100644
--- a/libbb/herror_msg.c
+++ b/libbb/herror_msg.c
@@ -26,3 +26,13 @@ void FAST_FUNC bb_herror_msg_and_die(const char *s, ...)
26 va_end(p); 26 va_end(p);
27 xfunc_die(); 27 xfunc_die();
28} 28}
29
30void FAST_FUNC bb_simple_herror_msg(const char *s)
31{
32 bb_herror_msg("%s", s);
33}
34
35void FAST_FUNC bb_simple_herror_msg_and_die(const char *s)
36{
37 bb_herror_msg_and_die("%s", s);
38}
diff --git a/libbb/mtab.c b/libbb/mtab.c
index 131705ddb..aa1a2a103 100644
--- a/libbb/mtab.c
+++ b/libbb/mtab.c
@@ -21,7 +21,7 @@ void FAST_FUNC erase_mtab(const char *name)
21 /* Bummer. Fall back on trying the /proc filesystem */ 21 /* Bummer. Fall back on trying the /proc filesystem */
22 if (!mountTable) mountTable = setmntent("/proc/mounts", "r"); 22 if (!mountTable) mountTable = setmntent("/proc/mounts", "r");
23 if (!mountTable) { 23 if (!mountTable) {
24 bb_perror_msg(bb_path_mtab_file); 24 bb_simple_perror_msg(bb_path_mtab_file);
25 return; 25 return;
26 } 26 }
27 27
@@ -49,6 +49,6 @@ void FAST_FUNC erase_mtab(const char *name)
49 } 49 }
50 endmntent(mountTable); 50 endmntent(mountTable);
51 } else if (errno != EROFS) 51 } else if (errno != EROFS)
52 bb_perror_msg(bb_path_mtab_file); 52 bb_simple_perror_msg(bb_path_mtab_file);
53} 53}
54#endif 54#endif
diff --git a/libbb/perror_nomsg.c b/libbb/perror_nomsg.c
index a2a11cc8e..d7d53de44 100644
--- a/libbb/perror_nomsg.c
+++ b/libbb/perror_nomsg.c
@@ -12,11 +12,11 @@
12 * instead of including libbb.h */ 12 * instead of including libbb.h */
13//#include "libbb.h" 13//#include "libbb.h"
14#include "platform.h" 14#include "platform.h"
15extern void bb_perror_msg(const char *s, ...) FAST_FUNC; 15extern void bb_simple_perror_msg(const char *s) FAST_FUNC;
16 16
17/* suppress gcc "no previous prototype" warning */ 17/* suppress gcc "no previous prototype" warning */
18void FAST_FUNC bb_perror_nomsg(void); 18void FAST_FUNC bb_perror_nomsg(void);
19void FAST_FUNC bb_perror_nomsg(void) 19void FAST_FUNC bb_perror_nomsg(void)
20{ 20{
21 bb_perror_msg(0); 21 bb_simple_perror_msg(0);
22} 22}
diff --git a/libbb/perror_nomsg_and_die.c b/libbb/perror_nomsg_and_die.c
index 543ff5178..bea5f25a5 100644
--- a/libbb/perror_nomsg_and_die.c
+++ b/libbb/perror_nomsg_and_die.c
@@ -12,11 +12,11 @@
12 * instead of including libbb.h */ 12 * instead of including libbb.h */
13//#include "libbb.h" 13//#include "libbb.h"
14#include "platform.h" 14#include "platform.h"
15extern void bb_perror_msg_and_die(const char *s, ...) FAST_FUNC; 15extern void bb_simple_perror_msg_and_die(const char *s) FAST_FUNC;
16 16
17/* suppress gcc "no previous prototype" warning */ 17/* suppress gcc "no previous prototype" warning */
18void FAST_FUNC bb_perror_nomsg_and_die(void); 18void FAST_FUNC bb_perror_nomsg_and_die(void);
19void FAST_FUNC bb_perror_nomsg_and_die(void) 19void FAST_FUNC bb_perror_nomsg_and_die(void)
20{ 20{
21 bb_perror_msg_and_die(0); 21 bb_simple_perror_msg_and_die(0);
22} 22}
diff --git a/libbb/read_printf.c b/libbb/read_printf.c
index cb582c080..0cd04ab7b 100644
--- a/libbb/read_printf.c
+++ b/libbb/read_printf.c
@@ -217,7 +217,7 @@ void FAST_FUNC xread(int fd, void *buf, size_t count)
217 if (count) { 217 if (count) {
218 ssize_t size = full_read(fd, buf, count); 218 ssize_t size = full_read(fd, buf, count);
219 if ((size_t)size != count) 219 if ((size_t)size != count)
220 bb_error_msg_and_die("short read"); 220 bb_simple_error_msg_and_die("short read");
221 } 221 }
222} 222}
223 223
diff --git a/libbb/safe_poll.c b/libbb/safe_poll.c
index cf93a9774..a07e785f3 100644
--- a/libbb/safe_poll.c
+++ b/libbb/safe_poll.c
@@ -27,7 +27,7 @@ int FAST_FUNC safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout)
27 /* I doubt many callers would handle this correctly! */ 27 /* I doubt many callers would handle this correctly! */
28 if (errno == ENOMEM) 28 if (errno == ENOMEM)
29 continue; 29 continue;
30 bb_perror_msg("poll"); 30 bb_simple_perror_msg("poll");
31 return n; 31 return n;
32 } 32 }
33} 33}
diff --git a/libbb/selinux_common.c b/libbb/selinux_common.c
index c2585557f..f917a1c6a 100644
--- a/libbb/selinux_common.c
+++ b/libbb/selinux_common.c
@@ -48,7 +48,7 @@ void FAST_FUNC selinux_preserve_fcontext(int fdesc)
48 if (fgetfilecon(fdesc, &context) < 0) { 48 if (fgetfilecon(fdesc, &context) < 0) {
49 if (errno == ENODATA || errno == ENOTSUP) 49 if (errno == ENODATA || errno == ENOTSUP)
50 return; 50 return;
51 bb_perror_msg_and_die("fgetfilecon failed"); 51 bb_simple_perror_msg_and_die("fgetfilecon failed");
52 } 52 }
53 setfscreatecon_or_die(context); 53 setfscreatecon_or_die(context);
54 freecon(context); 54 freecon(context);
diff --git a/libbb/time.c b/libbb/time.c
index f9b8da0b3..cab0ad602 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -258,7 +258,7 @@ char* FAST_FUNC strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp)
258static void get_mono(struct timespec *ts) 258static void get_mono(struct timespec *ts)
259{ 259{
260 if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, ts)) 260 if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, ts))
261 bb_error_msg_and_die("clock_gettime(MONOTONIC) failed"); 261 bb_simple_error_msg_and_die("clock_gettime(MONOTONIC) failed");
262} 262}
263unsigned long long FAST_FUNC monotonic_ns(void) 263unsigned long long FAST_FUNC monotonic_ns(void)
264{ 264{
diff --git a/libbb/update_passwd.c b/libbb/update_passwd.c
index dc967683a..c605c4c64 100644
--- a/libbb/update_passwd.c
+++ b/libbb/update_passwd.c
@@ -25,7 +25,7 @@ static void check_selinux_update_passwd(const char *username)
25 return; /* No need to check */ 25 return; /* No need to check */
26 26
27 if (getprevcon_raw(&context) < 0) 27 if (getprevcon_raw(&context) < 0)
28 bb_perror_msg_and_die("getprevcon failed"); 28 bb_simple_perror_msg_and_die("getprevcon failed");
29 seuser = strtok(context, ":"); 29 seuser = strtok(context, ":");
30 if (!seuser) 30 if (!seuser)
31 bb_error_msg_and_die("invalid context '%s'", context); 31 bb_error_msg_and_die("invalid context '%s'", context);
@@ -42,7 +42,7 @@ static void check_selinux_update_passwd(const char *username)
42 42
43 if (selinux_check_passwd_access(av) != 0) 43 if (selinux_check_passwd_access(av) != 0)
44 die: 44 die:
45 bb_error_msg_and_die("SELinux: access denied"); 45 bb_simple_error_msg_and_die("SELinux: access denied");
46 } 46 }
47 if (ENABLE_FEATURE_CLEAN_UP) 47 if (ENABLE_FEATURE_CLEAN_UP)
48 freecon(context); 48 freecon(context);
diff --git a/libbb/uuencode.c b/libbb/uuencode.c
index f32a3da7d..d36b34f63 100644
--- a/libbb/uuencode.c
+++ b/libbb/uuencode.c
@@ -213,7 +213,7 @@ void FAST_FUNC read_base64(FILE *src_stream, FILE *dst_stream, int flags)
213 if (*in_tail == '\0') 213 if (*in_tail == '\0')
214 return; 214 return;
215 /* No */ 215 /* No */
216 bb_error_msg_and_die("truncated base64 input"); 216 bb_simple_error_msg_and_die("truncated base64 input");
217 } 217 }
218 218
219 /* It was partial decode */ 219 /* It was partial decode */
diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c
index 6d3459905..71512aee2 100644
--- a/libbb/verror_msg.c
+++ b/libbb/verror_msg.c
@@ -197,4 +197,19 @@ void FAST_FUNC bb_info_msg(const char *s, ...)
197 bb_vinfo_msg(s, p); 197 bb_vinfo_msg(s, p);
198 va_end(p); 198 va_end(p);
199} 199}
200
201void FAST_FUNC bb_simple_info_msg(const char *s)
202{
203 bb_info_msg("%s", s);
204}
200#endif 205#endif
206
207void FAST_FUNC bb_simple_error_msg(const char *s)
208{
209 bb_error_msg("%s", s);
210}
211
212void FAST_FUNC bb_simple_error_msg_and_die(const char *s)
213{
214 bb_error_msg_and_die("%s", s);
215}
diff --git a/libbb/warn_ignoring_args.c b/libbb/warn_ignoring_args.c
index 3f3025c03..b24546e41 100644
--- a/libbb/warn_ignoring_args.c
+++ b/libbb/warn_ignoring_args.c
@@ -12,7 +12,7 @@
12void FAST_FUNC bb_warn_ignoring_args(char *arg) 12void FAST_FUNC bb_warn_ignoring_args(char *arg)
13{ 13{
14 if (arg) { 14 if (arg) {
15 bb_error_msg("ignoring all arguments"); 15 bb_simple_error_msg("ignoring all arguments");
16 } 16 }
17} 17}
18#endif 18#endif
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
index eb2871cb1..e9a2470e4 100644
--- a/libbb/xconnect.c
+++ b/libbb/xconnect.c
@@ -66,7 +66,7 @@ int FAST_FUNC setsockopt_bindtodevice(int fd, const char *iface)
66int FAST_FUNC setsockopt_bindtodevice(int fd UNUSED_PARAM, 66int FAST_FUNC setsockopt_bindtodevice(int fd UNUSED_PARAM,
67 const char *iface UNUSED_PARAM) 67 const char *iface UNUSED_PARAM)
68{ 68{
69 bb_error_msg("SO_BINDTODEVICE is not supported on this system"); 69 bb_simple_error_msg("SO_BINDTODEVICE is not supported on this system");
70 return -1; 70 return -1;
71} 71}
72#endif 72#endif
@@ -109,7 +109,7 @@ void FAST_FUNC xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen)
109 bb_perror_msg_and_die("%s (%s)", 109 bb_perror_msg_and_die("%s (%s)",
110 "can't connect to remote host", 110 "can't connect to remote host",
111 inet_ntoa(((struct sockaddr_in *)s_addr)->sin_addr)); 111 inet_ntoa(((struct sockaddr_in *)s_addr)->sin_addr));
112 bb_perror_msg_and_die("can't connect to remote host"); 112 bb_simple_perror_msg_and_die("can't connect to remote host");
113 } 113 }
114} 114}
115 115
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index b4d512bd6..ee2dbdef1 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -426,6 +426,6 @@ int FAST_FUNC wait_for_exitstatus(pid_t pid)
426 426
427 n = safe_waitpid(pid, &exit_status, 0); 427 n = safe_waitpid(pid, &exit_status, 0);
428 if (n < 0) 428 if (n < 0)
429 bb_perror_msg_and_die("waitpid"); 429 bb_simple_perror_msg_and_die("waitpid");
430 return exit_status; 430 return exit_status;
431} 431}
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 6cc60f6c0..93f325c62 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -27,7 +27,7 @@
27 27
28void FAST_FUNC bb_die_memory_exhausted(void) 28void FAST_FUNC bb_die_memory_exhausted(void)
29{ 29{
30 bb_error_msg_and_die(bb_msg_memory_exhausted); 30 bb_simple_error_msg_and_die(bb_msg_memory_exhausted);
31} 31}
32 32
33#ifndef DMALLOC 33#ifndef DMALLOC
@@ -40,7 +40,7 @@ void* FAST_FUNC malloc_or_warn(size_t size)
40{ 40{
41 void *ptr = malloc(size); 41 void *ptr = malloc(size);
42 if (ptr == NULL && size != 0) 42 if (ptr == NULL && size != 0)
43 bb_error_msg(bb_msg_memory_exhausted); 43 bb_simple_error_msg(bb_msg_memory_exhausted);
44 return ptr; 44 return ptr;
45} 45}
46 46
@@ -97,7 +97,7 @@ char* FAST_FUNC xstrndup(const char *s, int n)
97 char *t; 97 char *t;
98 98
99 if (ENABLE_DEBUG && s == NULL) 99 if (ENABLE_DEBUG && s == NULL)
100 bb_error_msg_and_die("xstrndup bug"); 100 bb_simple_error_msg_and_die("xstrndup bug");
101 101
102 /* We can just xmalloc(n+1) and strncpy into it, */ 102 /* We can just xmalloc(n+1) and strncpy into it, */
103 /* but think about xstrndup("abc", 10000) wastage! */ 103 /* but think about xstrndup("abc", 10000) wastage! */
@@ -215,13 +215,13 @@ int FAST_FUNC rename_or_warn(const char *oldpath, const char *newpath)
215void FAST_FUNC xpipe(int filedes[2]) 215void FAST_FUNC xpipe(int filedes[2])
216{ 216{
217 if (pipe(filedes)) 217 if (pipe(filedes))
218 bb_perror_msg_and_die("can't create pipe"); 218 bb_simple_perror_msg_and_die("can't create pipe");
219} 219}
220 220
221void FAST_FUNC xdup2(int from, int to) 221void FAST_FUNC xdup2(int from, int to)
222{ 222{
223 if (dup2(from, to) != to) 223 if (dup2(from, to) != to)
224 bb_perror_msg_and_die("can't duplicate file descriptor"); 224 bb_simple_perror_msg_and_die("can't duplicate file descriptor");
225 // " %d to %d", from, to); 225 // " %d to %d", from, to);
226} 226}
227 227
@@ -245,7 +245,7 @@ void FAST_FUNC xwrite(int fd, const void *buf, size_t count)
245 * or some writes succeeded, then we hit an error. 245 * or some writes succeeded, then we hit an error.
246 * In either case, errno is set. 246 * In either case, errno is set.
247 */ 247 */
248 bb_perror_msg_and_die( 248 bb_simple_perror_msg_and_die(
249 size >= 0 ? "short write" : "write error" 249 size >= 0 ? "short write" : "write error"
250 ); 250 );
251 } 251 }
@@ -259,7 +259,7 @@ void FAST_FUNC xwrite_str(int fd, const char *str)
259void FAST_FUNC xclose(int fd) 259void FAST_FUNC xclose(int fd)
260{ 260{
261 if (close(fd)) 261 if (close(fd))
262 bb_perror_msg_and_die("close failed"); 262 bb_simple_perror_msg_and_die("close failed");
263} 263}
264 264
265// Die with an error message if we can't lseek to the right spot. 265// 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)
267{ 267{
268 off_t off = lseek(fd, offset, whence); 268 off_t off = lseek(fd, offset, whence);
269 if (off == (off_t)-1) { 269 if (off == (off_t)-1) {
270 if (whence == SEEK_SET) 270 bb_perror_msg_and_die("lseek(%"OFF_FMT"u, %d)", offset, whence);
271 bb_perror_msg_and_die("lseek(%"OFF_FMT"u)", offset);
272 bb_perror_msg_and_die("lseek");
273 } 271 }
274 return off; 272 return off;
275} 273}
@@ -384,23 +382,23 @@ void FAST_FUNC bb_unsetenv_and_free(char *var)
384// setgid() will fail and we'll _still_be_root_, which is bad.) 382// setgid() will fail and we'll _still_be_root_, which is bad.)
385void FAST_FUNC xsetgid(gid_t gid) 383void FAST_FUNC xsetgid(gid_t gid)
386{ 384{
387 if (setgid(gid)) bb_perror_msg_and_die("setgid"); 385 if (setgid(gid)) bb_simple_perror_msg_and_die("setgid");
388} 386}
389 387
390// Die with an error message if we can't set uid. (See xsetgid() for why.) 388// Die with an error message if we can't set uid. (See xsetgid() for why.)
391void FAST_FUNC xsetuid(uid_t uid) 389void FAST_FUNC xsetuid(uid_t uid)
392{ 390{
393 if (setuid(uid)) bb_perror_msg_and_die("setuid"); 391 if (setuid(uid)) bb_simple_perror_msg_and_die("setuid");
394} 392}
395 393
396void FAST_FUNC xsetegid(gid_t egid) 394void FAST_FUNC xsetegid(gid_t egid)
397{ 395{
398 if (setegid(egid)) bb_perror_msg_and_die("setegid"); 396 if (setegid(egid)) bb_simple_perror_msg_and_die("setegid");
399} 397}
400 398
401void FAST_FUNC xseteuid(uid_t euid) 399void FAST_FUNC xseteuid(uid_t euid)
402{ 400{
403 if (seteuid(euid)) bb_perror_msg_and_die("seteuid"); 401 if (seteuid(euid)) bb_simple_perror_msg_and_die("seteuid");
404} 402}
405 403
406// Die if we can't chdir to a new path. 404// Die if we can't chdir to a new path.
@@ -413,7 +411,7 @@ void FAST_FUNC xchdir(const char *path)
413void FAST_FUNC xfchdir(int fd) 411void FAST_FUNC xfchdir(int fd)
414{ 412{
415 if (fchdir(fd)) 413 if (fchdir(fd))
416 bb_perror_msg_and_die("fchdir"); 414 bb_simple_perror_msg_and_die("fchdir");
417} 415}
418 416
419void FAST_FUNC xchroot(const char *path) 417void FAST_FUNC xchroot(const char *path)
@@ -463,7 +461,7 @@ int FAST_FUNC xsocket(int domain, int type, int protocol)
463IF_FEATURE_IPV6(if (domain == AF_INET6) s = "INET6";) 461IF_FEATURE_IPV6(if (domain == AF_INET6) s = "INET6";)
464 bb_perror_msg_and_die("socket(AF_%s,%d,%d)", s, type, protocol); 462 bb_perror_msg_and_die("socket(AF_%s,%d,%d)", s, type, protocol);
465#else 463#else
466 bb_perror_msg_and_die("socket"); 464 bb_simple_perror_msg_and_die("socket");
467#endif 465#endif
468 } 466 }
469 467
@@ -473,13 +471,13 @@ IF_FEATURE_IPV6(if (domain == AF_INET6) s = "INET6";)
473// Die with an error message if we can't bind a socket to an address. 471// Die with an error message if we can't bind a socket to an address.
474void FAST_FUNC xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) 472void FAST_FUNC xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen)
475{ 473{
476 if (bind(sockfd, my_addr, addrlen)) bb_perror_msg_and_die("bind"); 474 if (bind(sockfd, my_addr, addrlen)) bb_simple_perror_msg_and_die("bind");
477} 475}
478 476
479// Die with an error message if we can't listen for connections on a socket. 477// Die with an error message if we can't listen for connections on a socket.
480void FAST_FUNC xlisten(int s, int backlog) 478void FAST_FUNC xlisten(int s, int backlog)
481{ 479{
482 if (listen(s, backlog)) bb_perror_msg_and_die("listen"); 480 if (listen(s, backlog)) bb_simple_perror_msg_and_die("listen");
483} 481}
484 482
485/* Die with an error message if sendto failed. 483/* 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
491 if (ret < 0) { 489 if (ret < 0) {
492 if (ENABLE_FEATURE_CLEAN_UP) 490 if (ENABLE_FEATURE_CLEAN_UP)
493 close(s); 491 close(s);
494 bb_perror_msg_and_die("sendto"); 492 bb_simple_perror_msg_and_die("sendto");
495 } 493 }
496 return ret; 494 return ret;
497} 495}
@@ -519,12 +517,12 @@ void FAST_FUNC selinux_or_die(void)
519#if ENABLE_SELINUX 517#if ENABLE_SELINUX
520 int rc = is_selinux_enabled(); 518 int rc = is_selinux_enabled();
521 if (rc == 0) { 519 if (rc == 0) {
522 bb_error_msg_and_die("SELinux is disabled"); 520 bb_simple_error_msg_and_die("SELinux is disabled");
523 } else if (rc < 0) { 521 } else if (rc < 0) {
524 bb_error_msg_and_die("is_selinux_enabled() failed"); 522 bb_simple_error_msg_and_die("is_selinux_enabled() failed");
525 } 523 }
526#else 524#else
527 bb_error_msg_and_die("SELinux support is disabled"); 525 bb_simple_error_msg_and_die("SELinux support is disabled");
528#endif 526#endif
529} 527}
530 528
@@ -675,7 +673,7 @@ pid_t FAST_FUNC xfork(void)
675 pid_t pid; 673 pid_t pid;
676 pid = fork(); 674 pid = fork();
677 if (pid < 0) /* wtf? */ 675 if (pid < 0) /* wtf? */
678 bb_perror_msg_and_die("vfork"+1); 676 bb_simple_perror_msg_and_die("vfork"+1);
679 return pid; 677 return pid;
680} 678}
681#endif 679#endif
diff --git a/libbb/xgetcwd.c b/libbb/xgetcwd.c
index 7f9088bda..f4e768982 100644
--- a/libbb/xgetcwd.c
+++ b/libbb/xgetcwd.c
@@ -33,7 +33,7 @@ xrealloc_getcwd_or_warn(char *cwd)
33 if (errno == ERANGE) 33 if (errno == ERANGE)
34 continue; 34 continue;
35 free(cwd); 35 free(cwd);
36 bb_perror_msg("getcwd"); 36 bb_simple_perror_msg("getcwd");
37 return NULL; 37 return NULL;
38 } 38 }
39 cwd = xrealloc(cwd, strlen(cwd) + 1); 39 cwd = xrealloc(cwd, strlen(cwd) + 1);
diff --git a/libbb/xgethostbyname.c b/libbb/xgethostbyname.c
index 89d0329cc..9446daba7 100644
--- a/libbb/xgethostbyname.c
+++ b/libbb/xgethostbyname.c
@@ -12,6 +12,6 @@ struct hostent* FAST_FUNC xgethostbyname(const char *name)
12{ 12{
13 struct hostent *retval = gethostbyname(name); 13 struct hostent *retval = gethostbyname(name);
14 if (!retval) 14 if (!retval)
15 bb_herror_msg_and_die("%s", name); 15 bb_simple_herror_msg_and_die(name);
16 return retval; 16 return retval;
17} 17}
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index baa961ff3..2a83c8a15 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -149,7 +149,7 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv)
149 149
150 /* need to be root */ 150 /* need to be root */
151 if (geteuid()) { 151 if (geteuid()) {
152 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 152 bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
153 } 153 }
154 /* Syntax: 154 /* Syntax:
155 * addgroup group 155 * addgroup group
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index 850c810c4..d3c795afa 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -159,7 +159,7 @@ static void passwd_wrapper(const char *login_name) NORETURN;
159static void passwd_wrapper(const char *login_name) 159static void passwd_wrapper(const char *login_name)
160{ 160{
161 BB_EXECLP("passwd", "passwd", "--", login_name, NULL); 161 BB_EXECLP("passwd", "passwd", "--", login_name, NULL);
162 bb_error_msg_and_die("can't execute passwd, you must set password manually"); 162 bb_simple_error_msg_and_die("can't execute passwd, you must set password manually");
163} 163}
164 164
165//FIXME: upstream adduser has no short options! NOT COMPATIBLE! 165//FIXME: upstream adduser has no short options! NOT COMPATIBLE!
@@ -193,7 +193,7 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
193 193
194 /* got root? */ 194 /* got root? */
195 if (geteuid()) { 195 if (geteuid()) {
196 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 196 bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
197 } 197 }
198 198
199 pw.pw_gecos = (char *)"Linux User,,,"; 199 pw.pw_gecos = (char *)"Linux User,,,";
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c
index dd0532c66..4e70b2557 100644
--- a/loginutils/chpasswd.c
+++ b/loginutils/chpasswd.c
@@ -63,7 +63,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv)
63 int opt; 63 int opt;
64 64
65 if (getuid() != 0) 65 if (getuid() != 0)
66 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 66 bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
67 67
68 opt = getopt32long(argv, "^" "emc:R:" "\0" "m--ec:e--mc:c--em", 68 opt = getopt32long(argv, "^" "emc:R:" "\0" "m--ec:e--mc:c--em",
69 chpasswd_longopts, 69 chpasswd_longopts,
@@ -81,7 +81,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv)
81 81
82 pass = strchr(name, ':'); 82 pass = strchr(name, ':');
83 if (!pass) 83 if (!pass)
84 bb_error_msg_and_die("missing new password"); 84 bb_simple_error_msg_and_die("missing new password");
85 *pass++ = '\0'; 85 *pass++ = '\0';
86 86
87 xuname2uid(name); /* dies if there is no such user */ 87 xuname2uid(name); /* dies if there is no such user */
diff --git a/loginutils/deluser.c b/loginutils/deluser.c
index d7e9327ba..56bc7eaa6 100644
--- a/loginutils/deluser.c
+++ b/loginutils/deluser.c
@@ -76,7 +76,7 @@ int deluser_main(int argc, char **argv)
76#endif 76#endif
77 77
78 if (geteuid() != 0) 78 if (geteuid() != 0)
79 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 79 bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
80 80
81 name = argv[1]; 81 name = argv[1];
82 member = NULL; 82 member = NULL;
diff --git a/loginutils/getty.c b/loginutils/getty.c
index 23e92bc77..7393a3d1c 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -168,7 +168,7 @@ static void parse_speeds(char *arg)
168 /* note: arg "0" turns into speed B0 */ 168 /* note: arg "0" turns into speed B0 */
169 G.numspeed++; 169 G.numspeed++;
170 if (G.numspeed > MAX_SPEED) 170 if (G.numspeed > MAX_SPEED)
171 bb_error_msg_and_die("too many alternate speeds"); 171 bb_simple_error_msg_and_die("too many alternate speeds");
172 } 172 }
173 debug("exiting parse_speeds\n"); 173 debug("exiting parse_speeds\n");
174} 174}
@@ -230,7 +230,7 @@ static void open_tty(void)
230 * Make sure it is open for read/write. 230 * Make sure it is open for read/write.
231 */ 231 */
232 if ((fcntl(0, F_GETFL) & (O_RDWR|O_RDONLY|O_WRONLY)) != O_RDWR) 232 if ((fcntl(0, F_GETFL) & (O_RDWR|O_RDONLY|O_WRONLY)) != O_RDWR)
233 bb_error_msg_and_die("stdin is not open for read/write"); 233 bb_simple_error_msg_and_die("stdin is not open for read/write");
234 234
235 /* Try to get real tty name instead of "-" */ 235 /* Try to get real tty name instead of "-" */
236 n = xmalloc_ttyname(0); 236 n = xmalloc_ttyname(0);
@@ -243,7 +243,7 @@ static void open_tty(void)
243static void set_tty_attrs(void) 243static void set_tty_attrs(void)
244{ 244{
245 if (tcsetattr_stdin_TCSANOW(&G.tty_attrs) < 0) 245 if (tcsetattr_stdin_TCSANOW(&G.tty_attrs) < 0)
246 bb_perror_msg_and_die("tcsetattr"); 246 bb_simple_perror_msg_and_die("tcsetattr");
247} 247}
248 248
249/* We manipulate tty_attrs this way: 249/* We manipulate tty_attrs this way:
@@ -485,7 +485,7 @@ static char *get_logname(void)
485 finalize_tty_attrs(); 485 finalize_tty_attrs();
486 if (errno == EINTR || errno == EIO) 486 if (errno == EINTR || errno == EIO)
487 exit(EXIT_SUCCESS); 487 exit(EXIT_SUCCESS);
488 bb_perror_msg_and_die(bb_msg_read_error); 488 bb_simple_perror_msg_and_die(bb_msg_read_error);
489 } 489 }
490 490
491 switch (c) { 491 switch (c) {
@@ -582,7 +582,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
582 // " sid %d pgid %d", 582 // " sid %d pgid %d",
583 // pid, getppid(), 583 // pid, getppid(),
584 // getsid(0), getpgid(0)); 584 // getsid(0), getpgid(0));
585 bb_perror_msg_and_die("setsid"); 585 bb_simple_perror_msg_and_die("setsid");
586 /* 586 /*
587 * When we can end up here? 587 * When we can end up here?
588 * Example: setsid() fails when run alone in interactive shell: 588 * Example: setsid() fails when run alone in interactive shell:
@@ -651,13 +651,13 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
651 tsid = tcgetsid(STDIN_FILENO); 651 tsid = tcgetsid(STDIN_FILENO);
652 if (tsid < 0 || pid != tsid) { 652 if (tsid < 0 || pid != tsid) {
653 if (ioctl(STDIN_FILENO, TIOCSCTTY, /*force:*/ (long)1) < 0) 653 if (ioctl(STDIN_FILENO, TIOCSCTTY, /*force:*/ (long)1) < 0)
654 bb_perror_msg_and_die("TIOCSCTTY"); 654 bb_simple_perror_msg_and_die("TIOCSCTTY");
655 } 655 }
656 656
657#ifdef __linux__ 657#ifdef __linux__
658 /* Make ourself a foreground process group within our session */ 658 /* Make ourself a foreground process group within our session */
659 if (tcsetpgrp(STDIN_FILENO, pid) < 0) 659 if (tcsetpgrp(STDIN_FILENO, pid) < 0)
660 bb_perror_msg_and_die("tcsetpgrp"); 660 bb_simple_perror_msg_and_die("tcsetpgrp");
661#endif 661#endif
662 662
663 /* 663 /*
@@ -669,7 +669,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
669 * 5 seconds seems to be a good value. 669 * 5 seconds seems to be a good value.
670 */ 670 */
671 if (tcgetattr(STDIN_FILENO, &G.tty_attrs) < 0) 671 if (tcgetattr(STDIN_FILENO, &G.tty_attrs) < 0)
672 bb_perror_msg_and_die("tcgetattr"); 672 bb_simple_perror_msg_and_die("tcgetattr");
673 673
674 /* Update the utmp file. This tty is ours now! */ 674 /* Update the utmp file. This tty is ours now! */
675 update_utmp(pid, LOGIN_PROCESS, G.tty_name, "LOGIN", G.fakehost); 675 update_utmp(pid, LOGIN_PROCESS, G.tty_name, "LOGIN", G.fakehost);
diff --git a/loginutils/login.c b/loginutils/login.c
index a08642a34..4e65b3a19 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -358,7 +358,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
358 opt = getopt32(argv, "f:h:p", &opt_user, &opt_host); 358 opt = getopt32(argv, "f:h:p", &opt_user, &opt_host);
359 if (opt & LOGIN_OPT_f) { 359 if (opt & LOGIN_OPT_f) {
360 if (!run_by_root) 360 if (!run_by_root)
361 bb_error_msg_and_die("-f is for root only"); 361 bb_simple_error_msg_and_die("-f is for root only");
362 safe_strncpy(username, opt_user, sizeof(username)); 362 safe_strncpy(username, opt_user, sizeof(username));
363 } 363 }
364 argv += optind; 364 argv += optind;
@@ -529,7 +529,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
529 child_pid = vfork(); 529 child_pid = vfork();
530 if (child_pid != 0) { 530 if (child_pid != 0) {
531 if (child_pid < 0) 531 if (child_pid < 0)
532 bb_perror_msg("vfork"); 532 bb_simple_perror_msg("vfork");
533 else { 533 else {
534 wait_for_exitstatus(child_pid); 534 wait_for_exitstatus(child_pid);
535 update_utmp_DEAD_PROCESS(child_pid); 535 update_utmp_DEAD_PROCESS(child_pid);
diff --git a/loginutils/su.c b/loginutils/su.c
index 41291ea8f..7c1fc69c5 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -147,7 +147,7 @@ int su_main(int argc UNUSED_PARAM, char **argv)
147 syslog(LOG_NOTICE, "%c %s %s:%s", 147 syslog(LOG_NOTICE, "%c %s %s:%s",
148 '-', tty, old_user, opt_username); 148 '-', tty, old_user, opt_username);
149 bb_do_delay(LOGIN_FAIL_DELAY); 149 bb_do_delay(LOGIN_FAIL_DELAY);
150 bb_error_msg_and_die("incorrect password"); 150 bb_simple_error_msg_and_die("incorrect password");
151 } 151 }
152 152
153 if (ENABLE_FEATURE_CLEAN_UP && ENABLE_FEATURE_SU_SYSLOG) { 153 if (ENABLE_FEATURE_CLEAN_UP && ENABLE_FEATURE_SU_SYSLOG) {
@@ -165,7 +165,7 @@ int su_main(int argc UNUSED_PARAM, char **argv)
165 * probably a uucp account or has restricted access. Don't 165 * probably a uucp account or has restricted access. Don't
166 * compromise the account by allowing access with a standard 166 * compromise the account by allowing access with a standard
167 * shell. */ 167 * shell. */
168 bb_error_msg("using restricted shell"); 168 bb_simple_error_msg("using restricted shell");
169 opt_shell = NULL; /* ignore -s PROG */ 169 opt_shell = NULL; /* ignore -s PROG */
170 } 170 }
171 /* else: user can run whatever he wants via "su -s PROG USER". 171 /* else: user can run whatever he wants via "su -s PROG USER".
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index 9bb4d3613..099085340 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -56,7 +56,7 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
56 56
57 pwd = getpwuid(0); 57 pwd = getpwuid(0);
58 if (!pwd) { 58 if (!pwd) {
59 bb_error_msg_and_die("no password entry for root"); 59 bb_simple_error_msg_and_die("no password entry for root");
60 } 60 }
61 61
62 while (1) { 62 while (1) {
@@ -68,17 +68,17 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
68 ); 68 );
69 if (r < 0) { 69 if (r < 0) {
70 /* ^D, ^C, timeout, or read error */ 70 /* ^D, ^C, timeout, or read error */
71 bb_info_msg("normal startup"); 71 bb_simple_info_msg("normal startup");
72 return 0; 72 return 0;
73 } 73 }
74 if (r > 0) { 74 if (r > 0) {
75 break; 75 break;
76 } 76 }
77 bb_do_delay(LOGIN_FAIL_DELAY); 77 bb_do_delay(LOGIN_FAIL_DELAY);
78 bb_info_msg("Login incorrect"); 78 bb_simple_info_msg("Login incorrect");
79 } 79 }
80 80
81 bb_info_msg("starting shell for system maintenance"); 81 bb_simple_info_msg("starting shell for system maintenance");
82 82
83 IF_SELINUX(renew_current_security_context()); 83 IF_SELINUX(renew_current_security_context());
84 84
diff --git a/mailutils/mail.c b/mailutils/mail.c
index 6726654f7..3a1fd6949 100644
--- a/mailutils/mail.c
+++ b/mailutils/mail.c
@@ -15,7 +15,7 @@ static void signal_handler(int signo)
15{ 15{
16#define err signo 16#define err signo
17 if (SIGALRM == signo) { 17 if (SIGALRM == signo) {
18 bb_error_msg_and_die("timed out"); 18 bb_simple_error_msg_and_die("timed out");
19 } 19 }
20 20
21 // SIGCHLD. reap zombies 21 // SIGCHLD. reap zombies
@@ -128,7 +128,7 @@ static void encode_n_base64(const char *fname, const char *text, size_t len)
128 if (fname) { 128 if (fname) {
129 size = fread((char *)src_buf, 1, SRC_BUF_SIZE, fp); 129 size = fread((char *)src_buf, 1, SRC_BUF_SIZE, fp);
130 if ((ssize_t)size < 0) 130 if ((ssize_t)size < 0)
131 bb_perror_msg_and_die(bb_msg_read_error); 131 bb_simple_perror_msg_and_die(bb_msg_read_error);
132 } else { 132 } else {
133 size = len; 133 size = len;
134 if (len > SRC_BUF_SIZE) 134 if (len > SRC_BUF_SIZE)
@@ -179,5 +179,5 @@ void FAST_FUNC get_cred_or_die(int fd)
179 G.pass = xmalloc_reads(fd, /* maxsize: */ NULL); 179 G.pass = xmalloc_reads(fd, /* maxsize: */ NULL);
180 } 180 }
181 if (!G.user || !*G.user || !G.pass) 181 if (!G.user || !*G.user || !G.pass)
182 bb_error_msg_and_die("no username or password"); 182 bb_simple_error_msg_and_die("no username or password");
183} 183}
diff --git a/mailutils/popmaildir.c b/mailutils/popmaildir.c
index 589456715..6927e3a58 100644
--- a/mailutils/popmaildir.c
+++ b/mailutils/popmaildir.c
@@ -222,7 +222,7 @@ int popmaildir_main(int argc UNUSED_PARAM, char **argv)
222 fp = popen(delivery, "w"); 222 fp = popen(delivery, "w");
223 unsetenv("FILENAME"); 223 unsetenv("FILENAME");
224 if (!fp) { 224 if (!fp) {
225 bb_perror_msg("delivery helper"); 225 bb_simple_perror_msg("delivery helper");
226 break; 226 break;
227 } 227 }
228 } else 228 } else
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
index 32c50ba84..1bdc1c300 100644
--- a/mailutils/sendmail.c
+++ b/mailutils/sendmail.c
@@ -338,7 +338,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
338 smtp_check(NULL, 250); 338 smtp_check(NULL, 250);
339 else 339 else
340 if (code != 250) 340 if (code != 250)
341 bb_error_msg_and_die("SMTP init failed"); 341 bb_simple_error_msg_and_die("SMTP init failed");
342 } else { 342 } else {
343 // vanilla connection 343 // vanilla connection
344 int fd; 344 int fd;
diff --git a/miscutils/bc.c b/miscutils/bc.c
index aba51e5f8..7ac30dd53 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -893,7 +893,7 @@ static void fflush_and_check(void)
893{ 893{
894 fflush_all(); 894 fflush_all();
895 if (ferror(stdout) || ferror(stderr)) 895 if (ferror(stdout) || ferror(stderr))
896 bb_perror_msg_and_die("output error"); 896 bb_simple_perror_msg_and_die("output error");
897} 897}
898 898
899#if ENABLE_FEATURE_CLEAN_UP 899#if ENABLE_FEATURE_CLEAN_UP
@@ -908,7 +908,7 @@ static void quit(void) NORETURN;
908static void quit(void) 908static void quit(void)
909{ 909{
910 if (ferror(stdin)) 910 if (ferror(stdin))
911 bb_perror_msg_and_die("input error"); 911 bb_simple_perror_msg_and_die("input error");
912 fflush_and_check(); 912 fflush_and_check();
913 dbg_exec("quit(): exiting with exitcode SUCCESS"); 913 dbg_exec("quit(): exiting with exitcode SUCCESS");
914 exit(0); 914 exit(0);
@@ -2576,7 +2576,7 @@ static void xc_read_line(BcVec *vec, FILE *fp)
2576 goto get_char; 2576 goto get_char;
2577 if (c == EOF) { 2577 if (c == EOF) {
2578 if (ferror(fp)) 2578 if (ferror(fp))
2579 bb_perror_msg_and_die("input error"); 2579 bb_simple_perror_msg_and_die("input error");
2580 // Note: EOF does not append '\n' 2580 // Note: EOF does not append '\n'
2581 break; 2581 break;
2582 } 2582 }
@@ -6925,9 +6925,9 @@ static BC_STATUS zxc_vm_process(const char *text)
6925 ip = (void*)G.prog.exestack.v; 6925 ip = (void*)G.prog.exestack.v;
6926#if SANITY_CHECKS 6926#if SANITY_CHECKS
6927 if (G.prog.exestack.len != 1) // should have only main's IP 6927 if (G.prog.exestack.len != 1) // should have only main's IP
6928 bb_error_msg_and_die("BUG:call stack"); 6928 bb_simple_error_msg_and_die("BUG:call stack");
6929 if (ip->func != BC_PROG_MAIN) 6929 if (ip->func != BC_PROG_MAIN)
6930 bb_error_msg_and_die("BUG:not MAIN"); 6930 bb_simple_error_msg_and_die("BUG:not MAIN");
6931#endif 6931#endif
6932 f = xc_program_func_BC_PROG_MAIN(); 6932 f = xc_program_func_BC_PROG_MAIN();
6933 // bc discards strings, constants and code after each 6933 // bc discards strings, constants and code after each
@@ -6943,7 +6943,7 @@ static BC_STATUS zxc_vm_process(const char *text)
6943 if (IS_BC) { 6943 if (IS_BC) {
6944#if SANITY_CHECKS 6944#if SANITY_CHECKS
6945 if (G.prog.results.len != 0) // should be empty 6945 if (G.prog.results.len != 0) // should be empty
6946 bb_error_msg_and_die("BUG:data stack"); 6946 bb_simple_error_msg_and_die("BUG:data stack");
6947#endif 6947#endif
6948 IF_BC(bc_vec_pop_all(&f->strs);) 6948 IF_BC(bc_vec_pop_all(&f->strs);)
6949 IF_BC(bc_vec_pop_all(&f->consts);) 6949 IF_BC(bc_vec_pop_all(&f->consts);)
diff --git a/miscutils/chat.c b/miscutils/chat.c
index 5183d1369..a04565063 100644
--- a/miscutils/chat.c
+++ b/miscutils/chat.c
@@ -307,7 +307,7 @@ int chat_main(int argc UNUSED_PARAM, char **argv)
307 } else if (DIR_SAY == key) { 307 } else if (DIR_SAY == key) {
308 // just print argument verbatim 308 // just print argument verbatim
309 // TODO: should we use full_write() to avoid unistd/stdio conflict? 309 // TODO: should we use full_write() to avoid unistd/stdio conflict?
310 bb_error_msg("%s", arg); 310 bb_simple_error_msg(arg);
311 } 311 }
312 // next, please! 312 // next, please!
313 argv++; 313 argv++;
diff --git a/miscutils/crond.c b/miscutils/crond.c
index b533a3991..2e8ca8b68 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -731,7 +731,7 @@ fork_job(const char *user, int mailFd, CronLine *line, bool run_sendmail)
731 logmode = sv_logmode; 731 logmode = sv_logmode;
732 732
733 if (pid < 0) { 733 if (pid < 0) {
734 bb_perror_msg("vfork"); 734 bb_simple_perror_msg("vfork");
735 err: 735 err:
736 pid = 0; 736 pid = 0;
737 } /* else: PARENT, FORK SUCCESS */ 737 } /* else: PARENT, FORK SUCCESS */
@@ -861,7 +861,7 @@ static pid_t start_one_job(const char *user, CronLine *line)
861 bb_error_msg_and_die("can't execute '%s' for user %s", shell, user); 861 bb_error_msg_and_die("can't execute '%s' for user %s", shell, user);
862 } 862 }
863 if (pid < 0) { 863 if (pid < 0) {
864 bb_perror_msg("vfork"); 864 bb_simple_perror_msg("vfork");
865 err: 865 err:
866 pid = 0; 866 pid = 0;
867 } 867 }
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index 96dc4741a..c71d914fc 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -107,7 +107,7 @@ int crontab_main(int argc UNUSED_PARAM, char **argv)
107 if (sanitize_env_if_suid()) { /* Clears dangerous stuff, sets PATH */ 107 if (sanitize_env_if_suid()) { /* Clears dangerous stuff, sets PATH */
108 /* Run by non-root */ 108 /* Run by non-root */
109 if (opt_ler & (OPT_u|OPT_c)) 109 if (opt_ler & (OPT_u|OPT_c))
110 bb_error_msg_and_die(bb_msg_you_must_be_root); 110 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
111 } 111 }
112 112
113 if (opt_ler & OPT_u) { 113 if (opt_ler & OPT_u) {
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 5aef64b60..ef93c20ba 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -39,14 +39,14 @@ static unsigned check_under(void)
39{ 39{
40 unsigned p = pointer; 40 unsigned p = pointer;
41 if (p == 0) 41 if (p == 0)
42 bb_error_msg_and_die("stack underflow"); 42 bb_simple_error_msg_and_die("stack underflow");
43 return p - 1; 43 return p - 1;
44} 44}
45 45
46static void push(double a) 46static void push(double a)
47{ 47{
48 if (pointer >= STACK_SIZE) 48 if (pointer >= STACK_SIZE)
49 bb_error_msg_and_die("stack overflow"); 49 bb_simple_error_msg_and_die("stack overflow");
50 stack[pointer++] = a; 50 stack[pointer++] = a;
51} 51}
52 52
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index e4d104d0c..f3d935b2e 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -344,14 +344,19 @@ static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found";
344/* Busybox stuff */ 344/* Busybox stuff */
345#if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG 345#if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG
346#define info_logger(p, fmt, args...) bb_info_msg(fmt, ## args) 346#define info_logger(p, fmt, args...) bb_info_msg(fmt, ## args)
347#define simple_info_logger(p, msg) bb_simple_info_msg(msg)
347#define msg_logger(p, fmt, args...) bb_error_msg(fmt, ## args) 348#define msg_logger(p, fmt, args...) bb_error_msg(fmt, ## args)
349#define simple_msg_logger(p, msg) bb_simple_error_msg(msg)
348#define msg_logger_and_die(p, fmt, args...) bb_error_msg_and_die(fmt, ## args) 350#define msg_logger_and_die(p, fmt, args...) bb_error_msg_and_die(fmt, ## args)
351#define simple_msg_logger_and_die(p, msg) bb_simple_error_msg_and_die(msg)
349#define error_logger(p, fmt, args...) bb_perror_msg(fmt, ## args) 352#define error_logger(p, fmt, args...) bb_perror_msg(fmt, ## args)
350#define error_logger_and_die(p, fmt, args...) bb_perror_msg_and_die(fmt, ## args) 353#define error_logger_and_die(p, fmt, args...) bb_perror_msg_and_die(fmt, ## args)
351#else 354#else
352#define info_logger(p, fmt, args...) 355#define info_logger(p, fmt, args...)
353#define msg_logger(p, fmt, args...) 356#define msg_logger(p, fmt, args...)
357#define simple_msg_logger(p, msg)
354#define msg_logger_and_die(p, fmt, args...) exit(EXIT_FAILURE) 358#define msg_logger_and_die(p, fmt, args...) exit(EXIT_FAILURE)
359#define simple_msg_logger_and_die(p, msg) exit(EXIT_FAILURE)
355#define error_logger(p, fmt, args...) 360#define error_logger(p, fmt, args...)
356#define error_logger_and_die(p, fmt, args...) exit(EXIT_FAILURE) 361#define error_logger_and_die(p, fmt, args...) exit(EXIT_FAILURE)
357#endif 362#endif
@@ -727,7 +732,7 @@ static int do_servicing(int fd, unsigned long event_mask)
727 caught_sighup = FALSE; 732 caught_sighup = FALSE;
728 return c_sighup; 733 return c_sighup;
729 } 734 }
730 msg_logger_and_die(LOG_ERR, "read error on control file"); 735 simple_msg_logger_and_die(LOG_ERR, "read error on control file");
731} /* End Function do_servicing */ 736} /* End Function do_servicing */
732 737
733static void service_name(const struct devfsd_notify_struct *info) 738static void service_name(const struct devfsd_notify_struct *info)
@@ -786,7 +791,7 @@ static void service_name(const struct devfsd_notify_struct *info)
786 action_compat(info, entry->action.what); 791 action_compat(info, entry->action.what);
787 break; 792 break;
788 default: 793 default:
789 msg_logger_and_die(LOG_ERR, "Unknown action"); 794 simple_msg_logger_and_die(LOG_ERR, "Unknown action");
790 } 795 }
791 } 796 }
792} /* End Function service_name */ 797} /* End Function service_name */
@@ -1691,7 +1696,7 @@ int st_expr_expand(char *output, unsigned int length, const char *input,
1691 } 1696 }
1692 return FALSE; 1697 return FALSE;
1693st_expr_expand_out: 1698st_expr_expand_out:
1694 info_logger(LOG_INFO, bb_msg_small_buffer); 1699 simple_info_logger(LOG_INFO, bb_msg_small_buffer);
1695 return FALSE; 1700 return FALSE;
1696} /* End Function st_expr_expand */ 1701} /* End Function st_expr_expand */
1697 1702
@@ -1775,7 +1780,7 @@ static const char *expand_variable(char *buffer, unsigned int length,
1775 return input + len; 1780 return input + len;
1776 } 1781 }
1777 if (ch != ':' || ptr[1] != '-') { 1782 if (ch != ':' || ptr[1] != '-') {
1778 info_logger(LOG_INFO, "illegal char in var name"); 1783 simple_info_logger(LOG_INFO, "illegal char in var name");
1779 return NULL; 1784 return NULL;
1780 } 1785 }
1781 /* It's that handy "${var:-word}" expression. Check if var is defined */ 1786 /* 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,
1838 *out_pos += len; 1843 *out_pos += len;
1839 return input; 1844 return input;
1840expand_variable_out: 1845expand_variable_out:
1841 info_logger(LOG_INFO, bb_msg_small_buffer); 1846 simple_info_logger(LOG_INFO, bb_msg_small_buffer);
1842 return NULL; 1847 return NULL;
1843} /* End Function expand_variable */ 1848} /* End Function expand_variable */
1844 1849
diff --git a/miscutils/devmem.c b/miscutils/devmem.c
index 51ac3f22f..e8dce5225 100644
--- a/miscutils/devmem.c
+++ b/miscutils/devmem.c
@@ -89,7 +89,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
89 fd, 89 fd,
90 target & ~(off_t)(page_size - 1)); 90 target & ~(off_t)(page_size - 1));
91 if (map_base == MAP_FAILED) 91 if (map_base == MAP_FAILED)
92 bb_perror_msg_and_die("mmap"); 92 bb_simple_perror_msg_and_die("mmap");
93 93
94// printf("Memory mapped at address %p.\n", map_base); 94// printf("Memory mapped at address %p.\n", map_base);
95 95
@@ -110,7 +110,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
110 read_result = *(volatile uint64_t*)virt_addr; 110 read_result = *(volatile uint64_t*)virt_addr;
111 break; 111 break;
112 default: 112 default:
113 bb_error_msg_and_die("bad width"); 113 bb_simple_error_msg_and_die("bad width");
114 } 114 }
115// printf("Value at address 0x%"OFF_FMT"X (%p): 0x%llX\n", 115// printf("Value at address 0x%"OFF_FMT"X (%p): 0x%llX\n",
116// target, virt_addr, 116// target, virt_addr,
@@ -136,7 +136,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
136// read_result = *(volatile uint64_t*)virt_addr; 136// read_result = *(volatile uint64_t*)virt_addr;
137 break; 137 break;
138 default: 138 default:
139 bb_error_msg_and_die("bad width"); 139 bb_simple_error_msg_and_die("bad width");
140 } 140 }
141// printf("Written 0x%llX; readback 0x%llX\n", 141// printf("Written 0x%llX; readback 0x%llX\n",
142// (unsigned long long)writeval, 142// (unsigned long long)writeval,
@@ -145,7 +145,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
145 145
146 if (ENABLE_FEATURE_CLEAN_UP) { 146 if (ENABLE_FEATURE_CLEAN_UP) {
147 if (munmap(map_base, mapped_size) == -1) 147 if (munmap(map_base, mapped_size) == -1)
148 bb_perror_msg_and_die("munmap"); 148 bb_simple_perror_msg_and_die("munmap");
149 close(fd); 149 close(fd);
150 } 150 }
151 151
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index bba22d6d1..141957809 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
@@ -183,7 +183,7 @@ static void fb_open(const char *strfb_device)
183 (G.scr_var.yres_virtual ?: G.scr_var.yres) * G.scr_fix.line_length, 183 (G.scr_var.yres_virtual ?: G.scr_var.yres) * G.scr_fix.line_length,
184 PROT_WRITE, MAP_SHARED, fbfd, 0); 184 PROT_WRITE, MAP_SHARED, fbfd, 0);
185 if (G.addr == MAP_FAILED) 185 if (G.addr == MAP_FAILED)
186 bb_perror_msg_and_die("mmap"); 186 bb_simple_perror_msg_and_die("mmap");
187 187
188 // point to the start of the visible screen 188 // point to the start of the visible screen
189 G.addr += G.scr_var.yoffset * G.scr_fix.line_length + G.scr_var.xoffset * G.bytes_per_pixel; 189 G.addr += G.scr_var.yoffset * G.scr_fix.line_length + G.scr_var.xoffset * G.bytes_per_pixel;
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c
index a3dabdadb..c76d9a699 100644
--- a/miscutils/flash_eraseall.c
+++ b/miscutils/flash_eraseall.c
@@ -120,7 +120,7 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv)
120 if (clmlen > 8) 120 if (clmlen > 8)
121 clmlen = 8; 121 clmlen = 8;
122 if (clmlen == 0) 122 if (clmlen == 0)
123 bb_error_msg_and_die("autoplacement selected and no empty space in oob"); 123 bb_simple_error_msg_and_die("autoplacement selected and no empty space in oob");
124 } else { 124 } else {
125 /* Legacy mode */ 125 /* Legacy mode */
126 switch (meminfo.oobsize) { 126 switch (meminfo.oobsize) {
@@ -168,9 +168,9 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv)
168 if (errno == EOPNOTSUPP) { 168 if (errno == EOPNOTSUPP) {
169 flags |= OPTION_N; 169 flags |= OPTION_N;
170 if (flags & IS_NAND) 170 if (flags & IS_NAND)
171 bb_error_msg_and_die("bad block check not available"); 171 bb_simple_error_msg_and_die("bad block check not available");
172 } else { 172 } else {
173 bb_perror_msg_and_die("MEMGETBADBLOCK error"); 173 bb_simple_perror_msg_and_die("MEMGETBADBLOCK error");
174 } 174 }
175 } 175 }
176 } 176 }
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 342e240fa..b453efba9 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -810,7 +810,7 @@ static void identify(uint16_t *val)
810 like_std = 3; 810 like_std = 3;
811 } else 811 } else
812 /* "Unknown device type:\n\tbits 15&14 of general configuration word 0 both set to 1.\n" */ 812 /* "Unknown device type:\n\tbits 15&14 of general configuration word 0 both set to 1.\n" */
813 bb_error_msg_and_die("unknown device type"); 813 bb_simple_error_msg_and_die("unknown device type");
814 814
815 printf("%sremovable media\n", !(val[GEN_CONFIG] & MEDIA_REMOVABLE) ? "non-" : ""); 815 printf("%sremovable media\n", !(val[GEN_CONFIG] & MEDIA_REMOVABLE) ? "non-" : "");
816 /* Info from the specific configuration word says whether or not the 816 /* Info from the specific configuration word says whether or not the
@@ -1440,7 +1440,7 @@ static void flush_buffer_cache(/*int fd*/ void)
1440 sleep(1); 1440 sleep(1);
1441 if (ioctl(fd, HDIO_DRIVE_CMD, NULL) && errno != EINVAL) { /* await completion */ 1441 if (ioctl(fd, HDIO_DRIVE_CMD, NULL) && errno != EINVAL) { /* await completion */
1442 if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */ 1442 if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */
1443 bb_perror_msg("HDIO_DRIVE_CMD"); 1443 bb_simple_perror_msg("HDIO_DRIVE_CMD");
1444 else 1444 else
1445 bb_perror_msg("ioctl %#x failed", HDIO_DRIVE_CMD); 1445 bb_perror_msg("ioctl %#x failed", HDIO_DRIVE_CMD);
1446 } 1446 }
@@ -1506,7 +1506,7 @@ static void do_time(int cache /*,int fd*/)
1506 char *buf = xmalloc(TIMING_BUF_BYTES); 1506 char *buf = xmalloc(TIMING_BUF_BYTES);
1507 1507
1508 if (mlock(buf, TIMING_BUF_BYTES)) 1508 if (mlock(buf, TIMING_BUF_BYTES))
1509 bb_perror_msg_and_die("mlock"); 1509 bb_simple_perror_msg_and_die("mlock");
1510 1510
1511 /* Clear out the device request queues & give them time to complete. 1511 /* Clear out the device request queues & give them time to complete.
1512 * NB: *small* delay. User is expected to have a clue and to not run 1512 * NB: *small* delay. User is expected to have a clue and to not run
@@ -1857,7 +1857,7 @@ static void process_dev(char *devname)
1857 char buf[512]; 1857 char buf[512];
1858 flush_buffer_cache(); 1858 flush_buffer_cache();
1859 if (-1 == read(fd, buf, sizeof(buf))) 1859 if (-1 == read(fd, buf, sizeof(buf)))
1860 bb_perror_msg("read of 512 bytes failed"); 1860 bb_simple_perror_msg("read of 512 bytes failed");
1861 } 1861 }
1862#endif /* HDIO_DRIVE_CMD */ 1862#endif /* HDIO_DRIVE_CMD */
1863 if (getset_mult || get_identity) { 1863 if (getset_mult || get_identity) {
@@ -1865,7 +1865,7 @@ static void process_dev(char *devname)
1865 if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount)) { 1865 if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount)) {
1866 /* To be coherent with ioctl_or_warn. */ 1866 /* To be coherent with ioctl_or_warn. */
1867 if (getset_mult && ENABLE_IOCTL_HEX2STR_ERROR) 1867 if (getset_mult && ENABLE_IOCTL_HEX2STR_ERROR)
1868 bb_perror_msg("HDIO_GET_MULTCOUNT"); 1868 bb_simple_perror_msg("HDIO_GET_MULTCOUNT");
1869 else 1869 else
1870 bb_perror_msg("ioctl %#x failed", HDIO_GET_MULTCOUNT); 1870 bb_perror_msg("ioctl %#x failed", HDIO_GET_MULTCOUNT);
1871 } else if (getset_mult) { 1871 } else if (getset_mult) {
@@ -1985,7 +1985,7 @@ static void process_dev(char *devname)
1985 } else if (errno == -ENOMSG) 1985 } else if (errno == -ENOMSG)
1986 puts(" no identification info available"); 1986 puts(" no identification info available");
1987 else if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */ 1987 else if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */
1988 bb_perror_msg("HDIO_GET_IDENTITY"); 1988 bb_simple_perror_msg("HDIO_GET_IDENTITY");
1989 else 1989 else
1990 bb_perror_msg("ioctl %#x failed", HDIO_GET_IDENTITY); 1990 bb_perror_msg("ioctl %#x failed", HDIO_GET_IDENTITY);
1991 } 1991 }
diff --git a/miscutils/hexedit.c b/miscutils/hexedit.c
index 5c2f4a555..898d77376 100644
--- a/miscutils/hexedit.c
+++ b/miscutils/hexedit.c
@@ -193,7 +193,7 @@ static int remap(unsigned cur_pos)
193 ); 193 );
194 if (G.baseaddr == MAP_FAILED) { 194 if (G.baseaddr == MAP_FAILED) {
195 restore_term(); 195 restore_term();
196 bb_perror_msg_and_die("mmap"); 196 bb_simple_perror_msg_and_die("mmap");
197 } 197 }
198 198
199 G.current_byte = G.baseaddr + cur_pos; 199 G.current_byte = G.baseaddr + cur_pos;
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index 7a2e8534a..82a559f74 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -344,7 +344,7 @@ static void get_funcs_matrix(int fd, unsigned long *funcs)
344static void check_funcs_test_end(int funcs, int pec, const char *err) 344static void check_funcs_test_end(int funcs, int pec, const char *err)
345{ 345{
346 if (pec && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C))) 346 if (pec && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C)))
347 bb_error_msg("warning: adapter does not support PEC"); 347 bb_simple_error_msg("warning: adapter does not support PEC");
348 348
349 if (err) 349 if (err)
350 bb_error_msg_and_die( 350 bb_error_msg_and_die(
@@ -392,7 +392,7 @@ static void check_read_funcs(int fd, int mode, int data_addr, int pec)
392 break; 392 break;
393#endif /* ENABLE_I2CDUMP */ 393#endif /* ENABLE_I2CDUMP */
394 default: 394 default:
395 bb_error_msg_and_die("internal error"); 395 bb_simple_error_msg_and_die("internal error");
396 } 396 }
397 check_funcs_test_end(funcs, pec, err); 397 check_funcs_test_end(funcs, pec, err);
398} 398}
@@ -438,7 +438,7 @@ static void confirm_or_abort(void)
438{ 438{
439 fprintf(stderr, "Continue? [y/N] "); 439 fprintf(stderr, "Continue? [y/N] ");
440 if (!bb_ask_y_confirmation()) 440 if (!bb_ask_y_confirmation())
441 bb_error_msg_and_die("aborting"); 441 bb_simple_error_msg_and_die("aborting");
442} 442}
443 443
444/* 444/*
@@ -449,20 +449,20 @@ static void confirm_or_abort(void)
449 */ 449 */
450static void confirm_action(int bus_addr, int mode, int data_addr, int pec) 450static void confirm_action(int bus_addr, int mode, int data_addr, int pec)
451{ 451{
452 bb_error_msg("WARNING! This program can confuse your I2C bus"); 452 bb_simple_error_msg("WARNING! This program can confuse your I2C bus");
453 453
454 /* Don't let the user break his/her EEPROMs */ 454 /* Don't let the user break his/her EEPROMs */
455 if (bus_addr >= 0x50 && bus_addr <= 0x57 && pec) { 455 if (bus_addr >= 0x50 && bus_addr <= 0x57 && pec) {
456 bb_error_msg_and_die("this is I2C not smbus - using PEC on I2C " 456 bb_simple_error_msg_and_die("this is I2C not smbus - using PEC on I2C "
457 "devices may result in data loss, aborting"); 457 "devices may result in data loss, aborting");
458 } 458 }
459 459
460 if (mode == I2C_SMBUS_BYTE && data_addr >= 0 && pec) 460 if (mode == I2C_SMBUS_BYTE && data_addr >= 0 && pec)
461 bb_error_msg("WARNING! May interpret a write byte command " 461 bb_simple_error_msg("WARNING! May interpret a write byte command "
462 "with PEC as a write byte data command"); 462 "with PEC as a write byte data command");
463 463
464 if (pec) 464 if (pec)
465 bb_error_msg("PEC checking enabled"); 465 bb_simple_error_msg("PEC checking enabled");
466 466
467 confirm_or_abort(); 467 confirm_or_abort();
468} 468}
@@ -507,7 +507,7 @@ int i2cget_main(int argc UNUSED_PARAM, char **argv)
507 case 'w': mode = I2C_SMBUS_WORD_DATA; break; 507 case 'w': mode = I2C_SMBUS_WORD_DATA; break;
508 case 'c': mode = I2C_SMBUS_BYTE; break; 508 case 'c': mode = I2C_SMBUS_BYTE; break;
509 default: 509 default:
510 bb_error_msg("invalid mode"); 510 bb_simple_error_msg("invalid mode");
511 bb_show_usage(); 511 bb_show_usage();
512 } 512 }
513 pec = argv[3][1] == 'p'; 513 pec = argv[3][1] == 'p';
@@ -529,7 +529,7 @@ int i2cget_main(int argc UNUSED_PARAM, char **argv)
529 if (data_addr >= 0) { 529 if (data_addr >= 0) {
530 status = i2c_smbus_write_byte(fd, data_addr); 530 status = i2c_smbus_write_byte(fd, data_addr);
531 if (status < 0) 531 if (status < 0)
532 bb_error_msg("warning - write failed"); 532 bb_simple_error_msg("warning - write failed");
533 } 533 }
534 status = i2c_smbus_read_byte(fd); 534 status = i2c_smbus_read_byte(fd);
535 break; 535 break;
@@ -542,7 +542,7 @@ int i2cget_main(int argc UNUSED_PARAM, char **argv)
542 close(fd); 542 close(fd);
543 543
544 if (status < 0) 544 if (status < 0)
545 bb_perror_msg_and_die("read failed"); 545 bb_simple_perror_msg_and_die("read failed");
546 546
547 printf("0x%0*x\n", mode == I2C_SMBUS_WORD_DATA ? 4 : 2, status); 547 printf("0x%0*x\n", mode == I2C_SMBUS_WORD_DATA ? 4 : 2, status);
548 548
@@ -611,7 +611,7 @@ int i2cset_main(int argc, char **argv)
611 case 'i': mode = I2C_SMBUS_I2C_BLOCK_DATA; 611 case 'i': mode = I2C_SMBUS_I2C_BLOCK_DATA;
612 break; 612 break;
613 default: 613 default:
614 bb_error_msg("invalid mode"); 614 bb_simple_error_msg("invalid mode");
615 bb_show_usage(); 615 bb_show_usage();
616 } 616 }
617 617
@@ -620,11 +620,11 @@ int i2cset_main(int argc, char **argv)
620 || mode == I2C_SMBUS_I2C_BLOCK_DATA 620 || mode == I2C_SMBUS_I2C_BLOCK_DATA
621 ) { 621 ) {
622 if (pec && mode == I2C_SMBUS_I2C_BLOCK_DATA) 622 if (pec && mode == I2C_SMBUS_I2C_BLOCK_DATA)
623 bb_error_msg_and_die( 623 bb_simple_error_msg_and_die(
624 "PEC not supported for I2C " 624 "PEC not supported for I2C "
625 "block writes"); 625 "block writes");
626 if (opts & opt_m) 626 if (opts & opt_m)
627 bb_error_msg_and_die( 627 bb_simple_error_msg_and_die(
628 "mask not supported for block " 628 "mask not supported for block "
629 "writes"); 629 "writes");
630 } 630 }
@@ -685,7 +685,7 @@ int i2cset_main(int argc, char **argv)
685 } 685 }
686 686
687 if (tmpval < 0) 687 if (tmpval < 0)
688 bb_perror_msg_and_die("can't read old value"); 688 bb_simple_perror_msg_and_die("can't read old value");
689 689
690 val = (val & mask) | (tmpval & ~mask); 690 val = (val & mask) | (tmpval & ~mask);
691 691
@@ -724,7 +724,7 @@ int i2cset_main(int argc, char **argv)
724 break; 724 break;
725 } 725 }
726 if (status < 0) 726 if (status < 0)
727 bb_perror_msg_and_die("write failed"); 727 bb_simple_perror_msg_and_die("write failed");
728 728
729 if (pec) 729 if (pec)
730 i2c_set_pec(fd, 0); /* Clear PEC. */ 730 i2c_set_pec(fd, 0); /* Clear PEC. */
@@ -978,12 +978,12 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
978 case 's': mode = I2C_SMBUS_BLOCK_DATA; break; 978 case 's': mode = I2C_SMBUS_BLOCK_DATA; break;
979 case 'i': mode = I2C_SMBUS_I2C_BLOCK_DATA; break; 979 case 'i': mode = I2C_SMBUS_I2C_BLOCK_DATA; break;
980 default: 980 default:
981 bb_error_msg_and_die("invalid mode"); 981 bb_simple_error_msg_and_die("invalid mode");
982 } 982 }
983 983
984 if (argv[2][1] == 'p') { 984 if (argv[2][1] == 'p') {
985 if (argv[2][0] == 'W' || argv[2][0] == 'i') { 985 if (argv[2][0] == 'W' || argv[2][0] == 'i') {
986 bb_error_msg_and_die( 986 bb_simple_error_msg_and_die(
987 "pec not supported for -W and -i"); 987 "pec not supported for -W and -i");
988 } else { 988 } else {
989 pec = 1; 989 pec = 1;
@@ -994,7 +994,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
994 if (opts & opt_r) { 994 if (opts & opt_r) {
995 first = strtol(opt_r_str, &dash, 0); 995 first = strtol(opt_r_str, &dash, 0);
996 if (dash == opt_r_str || *dash != '-' || first > 0xff) 996 if (dash == opt_r_str || *dash != '-' || first > 0xff)
997 bb_error_msg_and_die("invalid range"); 997 bb_simple_error_msg_and_die("invalid range");
998 last = xstrtou_range(++dash, 0, first, 0xff); 998 last = xstrtou_range(++dash, 0, first, 0xff);
999 999
1000 /* Range is not available for every mode. */ 1000 /* Range is not available for every mode. */
@@ -1007,7 +1007,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
1007 break; 1007 break;
1008 /* Fall through */ 1008 /* Fall through */
1009 default: 1009 default:
1010 bb_error_msg_and_die( 1010 bb_simple_error_msg_and_die(
1011 "range not compatible with selected mode"); 1011 "range not compatible with selected mode");
1012 } 1012 }
1013 } 1013 }
@@ -1032,7 +1032,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
1032 if (mode == I2C_SMBUS_BYTE) { 1032 if (mode == I2C_SMBUS_BYTE) {
1033 res = i2c_smbus_write_byte(fd, first); 1033 res = i2c_smbus_write_byte(fd, first);
1034 if (res < 0) 1034 if (res < 0)
1035 bb_perror_msg_and_die("write start address"); 1035 bb_simple_perror_msg_and_die("write start address");
1036 } 1036 }
1037 1037
1038 dump_data(fd, mode, first, last, block, blen); 1038 dump_data(fd, mode, first, last, block, blen);
@@ -1398,7 +1398,7 @@ static void check_i2c_func(int fd)
1398 get_funcs_matrix(fd, &funcs); 1398 get_funcs_matrix(fd, &funcs);
1399 1399
1400 if (!(funcs & I2C_FUNC_I2C)) 1400 if (!(funcs & I2C_FUNC_I2C))
1401 bb_error_msg_and_die("adapter does not support I2C transfers"); 1401 bb_simple_error_msg_and_die("adapter does not support I2C transfers");
1402} 1402}
1403 1403
1404//usage:#define i2ctransfer_trivial_usage 1404//usage:#define i2ctransfer_trivial_usage
@@ -1451,7 +1451,7 @@ int i2ctransfer_main(int argc UNUSED_PARAM, char **argv)
1451 char *end; 1451 char *end;
1452 1452
1453 if (nmsgs >= I2C_RDWR_IOCTL_MAX_MSGS) 1453 if (nmsgs >= I2C_RDWR_IOCTL_MAX_MSGS)
1454 bb_error_msg_and_die("too many messages, max: "I2C_RDWR_IOCTL_MAX_MSGS_STR); 1454 bb_simple_error_msg_and_die("too many messages, max: "I2C_RDWR_IOCTL_MAX_MSGS_STR);
1455 1455
1456 flags = 0; 1456 flags = 0;
1457 arg_ptr = *argv; 1457 arg_ptr = *argv;
diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c
index ec0321941..8bff86ae5 100644
--- a/miscutils/inotifyd.c
+++ b/miscutils/inotifyd.c
@@ -117,7 +117,7 @@ int inotifyd_main(int argc, char **argv)
117 // open inotify 117 // open inotify
118 pfd.fd = inotify_init(); 118 pfd.fd = inotify_init();
119 if (pfd.fd < 0) 119 if (pfd.fd < 0)
120 bb_perror_msg_and_die("no kernel support"); 120 bb_simple_perror_msg_and_die("no kernel support");
121 121
122 // setup watches 122 // setup watches
123 while (*++argv) { 123 while (*++argv) {
diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c
index 09bcaaf63..f111c6363 100644
--- a/miscutils/nandwrite.c
+++ b/miscutils/nandwrite.c
@@ -101,7 +101,7 @@ static unsigned next_good_eraseblock(int fd, struct mtd_info_user *meminfo,
101 101
102 if (block_offset >= meminfo->size) { 102 if (block_offset >= meminfo->size) {
103 if (IS_NANDWRITE) 103 if (IS_NANDWRITE)
104 bb_error_msg_and_die("not enough space in MTD device"); 104 bb_simple_error_msg_and_die("not enough space in MTD device");
105 return block_offset; /* let the caller exit */ 105 return block_offset; /* let the caller exit */
106 } 106 }
107 offs = block_offset; 107 offs = block_offset;
@@ -174,7 +174,7 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
174 meminfo_writesize = meminfo.writesize; 174 meminfo_writesize = meminfo.writesize;
175 175
176 if (mtdoffset & (meminfo_writesize - 1)) 176 if (mtdoffset & (meminfo_writesize - 1))
177 bb_error_msg_and_die("start address is not page aligned"); 177 bb_simple_error_msg_and_die("start address is not page aligned");
178 178
179 filebuf = xmalloc(meminfo_writesize); 179 filebuf = xmalloc(meminfo_writesize);
180 oobbuf = xmalloc(meminfo.oobsize); 180 oobbuf = xmalloc(meminfo.oobsize);
@@ -248,9 +248,9 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
248 } 248 }
249 if (cnt < meminfo_writesize) { 249 if (cnt < meminfo_writesize) {
250 if (IS_NANDDUMP) 250 if (IS_NANDDUMP)
251 bb_error_msg_and_die("short read"); 251 bb_simple_error_msg_and_die("short read");
252 if (!(opts & OPT_p)) 252 if (!(opts & OPT_p))
253 bb_error_msg_and_die("input size is not rounded up to page size, " 253 bb_simple_error_msg_and_die("input size is not rounded up to page size, "
254 "use -p to zero pad"); 254 "use -p to zero pad");
255 /* zero pad to end of write block */ 255 /* zero pad to end of write block */
256 memset(filebuf + cnt, 0, meminfo_writesize - cnt); 256 memset(filebuf + cnt, 0, meminfo_writesize - cnt);
@@ -273,7 +273,7 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
273 /* We filled entire MTD, but did we reach EOF on input? */ 273 /* We filled entire MTD, but did we reach EOF on input? */
274 if (full_read(STDIN_FILENO, filebuf, meminfo_writesize) != 0) { 274 if (full_read(STDIN_FILENO, filebuf, meminfo_writesize) != 0) {
275 /* no */ 275 /* no */
276 bb_error_msg_and_die("not enough space in MTD device"); 276 bb_simple_error_msg_and_die("not enough space in MTD device");
277 } 277 }
278 } 278 }
279 279
diff --git a/miscutils/rfkill.c b/miscutils/rfkill.c
index 766bad8c7..db7c83750 100644
--- a/miscutils/rfkill.c
+++ b/miscutils/rfkill.c
@@ -88,7 +88,7 @@ int rfkill_main(int argc UNUSED_PARAM, char **argv)
88 88
89 rf_fd = device_open("/dev/rfkill", mode); 89 rf_fd = device_open("/dev/rfkill", mode);
90 if (rf_fd < 0) 90 if (rf_fd < 0)
91 bb_perror_msg_and_die("/dev/rfkill"); 91 bb_simple_perror_msg_and_die("/dev/rfkill");
92 92
93 if (rf_opt & OPT_l) { 93 if (rf_opt & OPT_l) {
94 while (full_read(rf_fd, &event, sizeof(event)) == RFKILL_EVENT_SIZE_V1) { 94 while (full_read(rf_fd, &event, sizeof(event)) == RFKILL_EVENT_SIZE_V1) {
diff --git a/miscutils/rx.c b/miscutils/rx.c
index 874a3f0a3..319ec1d49 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -120,7 +120,7 @@ static int receive(/*int read_fd, */int file_fd)
120 /* Write previously received block */ 120 /* Write previously received block */
121 errno = 0; 121 errno = 0;
122 if (full_write(file_fd, blockBuf, blockLength) != blockLength) { 122 if (full_write(file_fd, blockBuf, blockLength) != blockLength) {
123 bb_perror_msg(bb_msg_write_error); 123 bb_simple_perror_msg(bb_msg_write_error);
124 goto fatal; 124 goto fatal;
125 } 125 }
126 126
@@ -150,7 +150,7 @@ static int receive(/*int read_fd, */int file_fd)
150 goto timeout; 150 goto timeout;
151 151
152 if (blockNo != (255 - blockNoOnesCompl)) { 152 if (blockNo != (255 - blockNoOnesCompl)) {
153 bb_error_msg("bad block ones compl"); 153 bb_simple_error_msg("bad block ones compl");
154 goto error; 154 goto error;
155 } 155 }
156 156
@@ -229,7 +229,7 @@ static int receive(/*int read_fd, */int file_fd)
229 do_crc = 0; 229 do_crc = 0;
230 goto timeout; 230 goto timeout;
231 } 231 }
232 bb_error_msg("too many errors; giving up"); 232 bb_simple_error_msg("too many errors; giving up");
233 fatal: 233 fatal:
234 /* 5 CAN followed by 5 BS. Don't try too hard... */ 234 /* 5 CAN followed by 5 BS. Don't try too hard... */
235 safe_write(write_fd, "\030\030\030\030\030\010\010\010\010\010", 10); 235 safe_write(write_fd, "\030\030\030\030\030\010\010\010\010\010", 10);
diff --git a/miscutils/time.c b/miscutils/time.c
index 064888ab8..d15d363f3 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -88,7 +88,7 @@ static void resuse_end(pid_t pid, resource_t *resp)
88 * returns the child process, set the time the command finished. */ 88 * returns the child process, set the time the command finished. */
89 while ((caught = wait3(&resp->waitstatus, 0, &resp->ru)) != pid) { 89 while ((caught = wait3(&resp->waitstatus, 0, &resp->ru)) != pid) {
90 if (caught == -1 && errno != EINTR) { 90 if (caught == -1 && errno != EINTR) {
91 bb_perror_msg("wait"); 91 bb_simple_perror_msg("wait");
92 return; 92 return;
93 } 93 }
94 } 94 }
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c
index dc7af25a4..8318df0f9 100644
--- a/miscutils/ubi_tools.c
+++ b/miscutils/ubi_tools.c
@@ -234,10 +234,10 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
234 // bb_error_msg_and_die("%s invalid maximum size calculated", "UBI"); 234 // bb_error_msg_and_die("%s invalid maximum size calculated", "UBI");
235 } else 235 } else
236 if (!(opts & OPTION_s)) 236 if (!(opts & OPTION_s))
237 bb_error_msg_and_die("size not specified"); 237 bb_simple_error_msg_and_die("size not specified");
238 238
239 if (!(opts & OPTION_N)) 239 if (!(opts & OPTION_N))
240 bb_error_msg_and_die("name not specified"); 240 bb_simple_error_msg_and_die("name not specified");
241 241
242 /* the structure is memset(0) above */ 242 /* the structure is memset(0) above */
243 mkvol_req.vol_id = vol_id; 243 mkvol_req.vol_id = vol_id;
@@ -264,7 +264,7 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
264//usage: "\n -N VOLNAME Volume name" 264//usage: "\n -N VOLNAME Volume name"
265 if (do_rmvol) { 265 if (do_rmvol) {
266 if (!(opts & (OPTION_n|OPTION_N))) 266 if (!(opts & (OPTION_n|OPTION_N)))
267 bb_error_msg_and_die("volume id not specified"); 267 bb_simple_error_msg_and_die("volume id not specified");
268 268
269 if (opts & OPTION_N) { 269 if (opts & OPTION_N) {
270 unsigned num = ubi_devnum_from_devname(ubi_ctrl); 270 unsigned num = ubi_devnum_from_devname(ubi_ctrl);
@@ -288,9 +288,9 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
288//usage: "\n -s SIZE Size in bytes" 288//usage: "\n -s SIZE Size in bytes"
289 if (do_rsvol) { 289 if (do_rsvol) {
290 if (!(opts & OPTION_s)) 290 if (!(opts & OPTION_s))
291 bb_error_msg_and_die("size not specified"); 291 bb_simple_error_msg_and_die("size not specified");
292 if (!(opts & OPTION_n)) 292 if (!(opts & OPTION_n))
293 bb_error_msg_and_die("volume id not specified"); 293 bb_simple_error_msg_and_die("volume id not specified");
294 294
295 rsvol_req.bytes = size_bytes; /* signed int64_t */ 295 rsvol_req.bytes = size_bytes; /* signed int64_t */
296 rsvol_req.vol_id = vol_id; 296 rsvol_req.vol_id = vol_id;
diff --git a/miscutils/ubirename.c b/miscutils/ubirename.c
index 21bd10111..e7c56640c 100644
--- a/miscutils/ubirename.c
+++ b/miscutils/ubirename.c
@@ -72,7 +72,7 @@ int ubirename_main(int argc, char **argv)
72 rnvol = xzalloc(sizeof(*rnvol)); 72 rnvol = xzalloc(sizeof(*rnvol));
73 rnvol->count = --argc; 73 rnvol->count = --argc;
74 if (argc > ARRAY_SIZE(rnvol->ents)) 74 if (argc > ARRAY_SIZE(rnvol->ents))
75 bb_error_msg_and_die("too many renames requested"); 75 bb_simple_error_msg_and_die("too many renames requested");
76 76
77 ubi_devname = argv[1]; 77 ubi_devname = argv[1];
78 ubi_devnum = ubi_devnum_from_devname(ubi_devname); 78 ubi_devnum = ubi_devnum_from_devname(ubi_devname);
diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c
index 1a30dd87c..ac8632481 100644
--- a/modutils/modutils-24.c
+++ b/modutils/modutils-24.c
@@ -2600,7 +2600,7 @@ static void new_get_kernel_symbols(void)
2600 module_names = xrealloc(module_names, bufsize); 2600 module_names = xrealloc(module_names, bufsize);
2601 goto retry_modules_load; 2601 goto retry_modules_load;
2602 } 2602 }
2603 bb_perror_msg_and_die("QM_MODULES"); 2603 bb_simple_perror_msg_and_die("QM_MODULES");
2604 } 2604 }
2605 2605
2606 n_ext_modules = nmod = ret; 2606 n_ext_modules = nmod = ret;
@@ -2661,7 +2661,7 @@ static void new_get_kernel_symbols(void)
2661 syms = xrealloc(syms, bufsize); 2661 syms = xrealloc(syms, bufsize);
2662 goto retry_kern_sym_load; 2662 goto retry_kern_sym_load;
2663 } 2663 }
2664 bb_perror_msg_and_die("kernel: QM_SYMBOLS"); 2664 bb_simple_perror_msg_and_die("kernel: QM_SYMBOLS");
2665 } 2665 }
2666 nksyms = nsyms = ret; 2666 nksyms = nsyms = ret;
2667 ksyms = syms; 2667 ksyms = syms;
@@ -3247,21 +3247,21 @@ static struct obj_file *obj_load(char *image, size_t image_size, int loadprogbit
3247 f->load_order_search_start = &f->load_order; 3247 f->load_order_search_start = &f->load_order;
3248 3248
3249 if (image_size < sizeof(f->header)) 3249 if (image_size < sizeof(f->header))
3250 bb_error_msg_and_die("error while loading ELF header"); 3250 bb_simple_error_msg_and_die("error while loading ELF header");
3251 memcpy(&f->header, image, sizeof(f->header)); 3251 memcpy(&f->header, image, sizeof(f->header));
3252 3252
3253 if (*(aliased_uint32_t*)(&f->header.e_ident) != ELFMAG_U32) { 3253 if (*(aliased_uint32_t*)(&f->header.e_ident) != ELFMAG_U32) {
3254 bb_error_msg_and_die("not an ELF file"); 3254 bb_simple_error_msg_and_die("not an ELF file");
3255 } 3255 }
3256 if (f->header.e_ident[EI_CLASS] != ELFCLASSM 3256 if (f->header.e_ident[EI_CLASS] != ELFCLASSM
3257 || f->header.e_ident[EI_DATA] != (BB_BIG_ENDIAN ? ELFDATA2MSB : ELFDATA2LSB) 3257 || f->header.e_ident[EI_DATA] != (BB_BIG_ENDIAN ? ELFDATA2MSB : ELFDATA2LSB)
3258 || f->header.e_ident[EI_VERSION] != EV_CURRENT 3258 || f->header.e_ident[EI_VERSION] != EV_CURRENT
3259 || !MATCH_MACHINE(f->header.e_machine) 3259 || !MATCH_MACHINE(f->header.e_machine)
3260 ) { 3260 ) {
3261 bb_error_msg_and_die("ELF file not for this architecture"); 3261 bb_simple_error_msg_and_die("ELF file not for this architecture");
3262 } 3262 }
3263 if (f->header.e_type != ET_REL) { 3263 if (f->header.e_type != ET_REL) {
3264 bb_error_msg_and_die("ELF file not a relocatable object"); 3264 bb_simple_error_msg_and_die("ELF file not a relocatable object");
3265 } 3265 }
3266 3266
3267 /* Read the section headers. */ 3267 /* Read the section headers. */
@@ -3280,7 +3280,7 @@ static struct obj_file *obj_load(char *image, size_t image_size, int loadprogbit
3280 3280
3281 section_headers = alloca(sizeof(ElfW(Shdr)) * shnum); 3281 section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
3282 if (image_size < f->header.e_shoff + sizeof(ElfW(Shdr)) * shnum) 3282 if (image_size < f->header.e_shoff + sizeof(ElfW(Shdr)) * shnum)
3283 bb_error_msg_and_die("error while loading section headers"); 3283 bb_simple_error_msg_and_die("error while loading section headers");
3284 memcpy(section_headers, image + f->header.e_shoff, sizeof(ElfW(Shdr)) * shnum); 3284 memcpy(section_headers, image + f->header.e_shoff, sizeof(ElfW(Shdr)) * shnum);
3285 3285
3286 /* Read the section data. */ 3286 /* Read the section data. */
@@ -3317,16 +3317,16 @@ static struct obj_file *obj_load(char *image, size_t image_size, int loadprogbit
3317 if (sec->header.sh_size > 0) { 3317 if (sec->header.sh_size > 0) {
3318 sec->contents = xmalloc(sec->header.sh_size); 3318 sec->contents = xmalloc(sec->header.sh_size);
3319 if (image_size < (sec->header.sh_offset + sec->header.sh_size)) 3319 if (image_size < (sec->header.sh_offset + sec->header.sh_size))
3320 bb_error_msg_and_die("error while loading section data"); 3320 bb_simple_error_msg_and_die("error while loading section data");
3321 memcpy(sec->contents, image + sec->header.sh_offset, sec->header.sh_size); 3321 memcpy(sec->contents, image + sec->header.sh_offset, sec->header.sh_size);
3322 } 3322 }
3323 break; 3323 break;
3324#if SHT_RELM == SHT_REL 3324#if SHT_RELM == SHT_REL
3325 case SHT_RELA: 3325 case SHT_RELA:
3326 bb_error_msg_and_die("RELA relocations not supported on this architecture"); 3326 bb_simple_error_msg_and_die("RELA relocations not supported on this architecture");
3327#else 3327#else
3328 case SHT_REL: 3328 case SHT_REL:
3329 bb_error_msg_and_die("REL relocations not supported on this architecture"); 3329 bb_simple_error_msg_and_die("REL relocations not supported on this architecture");
3330#endif 3330#endif
3331 default: 3331 default:
3332 if (sec->header.sh_type >= SHT_LOPROC) { 3332 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,
3447 continue; 3447 continue;
3448 sec->contents = imagebase + (sec->header.sh_addr - base); 3448 sec->contents = imagebase + (sec->header.sh_addr - base);
3449 if (image_size < (sec->header.sh_offset + sec->header.sh_size)) { 3449 if (image_size < (sec->header.sh_offset + sec->header.sh_size)) {
3450 bb_error_msg("error reading ELF section data"); 3450 bb_simple_error_msg("error reading ELF section data");
3451 return 0; /* need to delete half-loaded module! */ 3451 return 0; /* need to delete half-loaded module! */
3452 } 3452 }
3453 memcpy(sec->contents, image + sec->header.sh_offset, sec->header.sh_size); 3453 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)
3845 if (m_has_modinfo) { 3845 if (m_has_modinfo) {
3846 int m_version = new_get_module_version(f, m_strversion); 3846 int m_version = new_get_module_version(f, m_strversion);
3847 if (m_version == -1) { 3847 if (m_version == -1) {
3848 bb_error_msg_and_die("can't find the kernel version " 3848 bb_simple_error_msg_and_die("can't find the kernel version "
3849 "the module was compiled for"); 3849 "the module was compiled for");
3850 } 3850 }
3851 } 3851 }
@@ -3864,7 +3864,7 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
3864#endif 3864#endif
3865 3865
3866 if (query_module(NULL, 0, NULL, 0, NULL)) 3866 if (query_module(NULL, 0, NULL, 0, NULL))
3867 bb_error_msg_and_die("old (unsupported) kernel"); 3867 bb_simple_error_msg_and_die("old (unsupported) kernel");
3868 new_get_kernel_symbols(); 3868 new_get_kernel_symbols();
3869 k_crcs = new_is_kernel_checksummed(); 3869 k_crcs = new_is_kernel_checksummed();
3870 3870
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index a3548879c..8d4639f50 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -52,7 +52,7 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
52 /* Unload _all_ unused modules via NULL delete_module() call */ 52 /* Unload _all_ unused modules via NULL delete_module() call */
53 err = bb_delete_module(NULL, flags); 53 err = bb_delete_module(NULL, flags);
54 if (err && err != EFAULT) 54 if (err && err != EFAULT)
55 bb_perror_msg_and_die("rmmod"); 55 bb_simple_perror_msg_and_die("rmmod");
56 return EXIT_SUCCESS; 56 return EXIT_SUCCESS;
57 } 57 }
58 58
diff --git a/networking/arp.c b/networking/arp.c
index 71bfe3cbf..6519f8156 100644
--- a/networking/arp.c
+++ b/networking/arp.c
@@ -116,7 +116,7 @@ static int arp_del(char **args)
116 /* Resolve the host name. */ 116 /* Resolve the host name. */
117 host = *args; 117 host = *args;
118 if (ap->input(host, &sa) < 0) { 118 if (ap->input(host, &sa) < 0) {
119 bb_herror_msg_and_die("%s", host); 119 bb_simple_herror_msg_and_die(host);
120 } 120 }
121 121
122 /* If a host has more than one address, use the correct one! */ 122 /* If a host has more than one address, use the correct one! */
@@ -149,7 +149,7 @@ static int arp_del(char **args)
149#ifdef HAVE_ATF_DONTPUB 149#ifdef HAVE_ATF_DONTPUB
150 req.arp_flags |= ATF_DONTPUB; 150 req.arp_flags |= ATF_DONTPUB;
151#else 151#else
152 bb_error_msg("feature ATF_DONTPUB is not supported"); 152 bb_simple_error_msg("feature ATF_DONTPUB is not supported");
153#endif 153#endif
154 args++; 154 args++;
155 break; 155 break;
@@ -157,7 +157,7 @@ static int arp_del(char **args)
157#ifdef HAVE_ATF_MAGIC 157#ifdef HAVE_ATF_MAGIC
158 req.arp_flags |= ATF_MAGIC; 158 req.arp_flags |= ATF_MAGIC;
159#else 159#else
160 bb_error_msg("feature ATF_MAGIC is not supported"); 160 bb_simple_error_msg("feature ATF_MAGIC is not supported");
161#endif 161#endif
162 args++; 162 args++;
163 break; 163 break;
@@ -173,7 +173,7 @@ static int arp_del(char **args)
173 if (strcmp(*args, "255.255.255.255") != 0) { 173 if (strcmp(*args, "255.255.255.255") != 0) {
174 host = *args; 174 host = *args;
175 if (ap->input(host, &sa) < 0) { 175 if (ap->input(host, &sa) < 0) {
176 bb_herror_msg_and_die("%s", host); 176 bb_simple_herror_msg_and_die(host);
177 } 177 }
178 memcpy(&req.arp_netmask, &sa, sizeof(struct sockaddr)); 178 memcpy(&req.arp_netmask, &sa, sizeof(struct sockaddr));
179 req.arp_flags |= ATF_NETMASK; 179 req.arp_flags |= ATF_NETMASK;
@@ -195,7 +195,7 @@ static int arp_del(char **args)
195 /* Call the kernel. */ 195 /* Call the kernel. */
196 if (flags & 2) { 196 if (flags & 2) {
197 if (option_mask32 & ARP_OPT_v) 197 if (option_mask32 & ARP_OPT_v)
198 bb_error_msg("SIOCDARP(nopub)"); 198 bb_simple_error_msg("SIOCDARP(nopub)");
199 err = ioctl(sockfd, SIOCDARP, &req); 199 err = ioctl(sockfd, SIOCDARP, &req);
200 if (err < 0) { 200 if (err < 0) {
201 if (errno == ENXIO) { 201 if (errno == ENXIO) {
@@ -204,20 +204,20 @@ static int arp_del(char **args)
204 printf("No ARP entry for %s\n", host); 204 printf("No ARP entry for %s\n", host);
205 return -1; 205 return -1;
206 } 206 }
207 bb_perror_msg_and_die("SIOCDARP(priv)"); 207 bb_simple_perror_msg_and_die("SIOCDARP(priv)");
208 } 208 }
209 } 209 }
210 if ((flags & 1) && err) { 210 if ((flags & 1) && err) {
211 nopub: 211 nopub:
212 req.arp_flags |= ATF_PUBL; 212 req.arp_flags |= ATF_PUBL;
213 if (option_mask32 & ARP_OPT_v) 213 if (option_mask32 & ARP_OPT_v)
214 bb_error_msg("SIOCDARP(pub)"); 214 bb_simple_error_msg("SIOCDARP(pub)");
215 if (ioctl(sockfd, SIOCDARP, &req) < 0) { 215 if (ioctl(sockfd, SIOCDARP, &req) < 0) {
216 if (errno == ENXIO) { 216 if (errno == ENXIO) {
217 printf("No ARP entry for %s\n", host); 217 printf("No ARP entry for %s\n", host);
218 return -1; 218 return -1;
219 } 219 }
220 bb_perror_msg_and_die("SIOCDARP(pub)"); 220 bb_simple_perror_msg_and_die("SIOCDARP(pub)");
221 } 221 }
222 } 222 }
223 return 0; 223 return 0;
@@ -233,7 +233,7 @@ static void arp_getdevhw(char *ifname, struct sockaddr *sa)
233 ioctl_or_perror_and_die(sockfd, SIOCGIFHWADDR, &ifr, 233 ioctl_or_perror_and_die(sockfd, SIOCGIFHWADDR, &ifr,
234 "can't get HW-Address for '%s'", ifname); 234 "can't get HW-Address for '%s'", ifname);
235 if (hw_set && (ifr.ifr_hwaddr.sa_family != hw->type)) { 235 if (hw_set && (ifr.ifr_hwaddr.sa_family != hw->type)) {
236 bb_error_msg_and_die("protocol type mismatch"); 236 bb_simple_error_msg_and_die("protocol type mismatch");
237 } 237 }
238 memcpy(sa, &(ifr.ifr_hwaddr), sizeof(struct sockaddr)); 238 memcpy(sa, &(ifr.ifr_hwaddr), sizeof(struct sockaddr));
239 239
@@ -261,20 +261,20 @@ static int arp_set(char **args)
261 261
262 host = *args++; 262 host = *args++;
263 if (ap->input(host, &sa) < 0) { 263 if (ap->input(host, &sa) < 0) {
264 bb_herror_msg_and_die("%s", host); 264 bb_simple_herror_msg_and_die(host);
265 } 265 }
266 /* If a host has more than one address, use the correct one! */ 266 /* If a host has more than one address, use the correct one! */
267 memcpy(&req.arp_pa, &sa, sizeof(struct sockaddr)); 267 memcpy(&req.arp_pa, &sa, sizeof(struct sockaddr));
268 268
269 /* Fetch the hardware address. */ 269 /* Fetch the hardware address. */
270 if (*args == NULL) { 270 if (*args == NULL) {
271 bb_error_msg_and_die("need hardware address"); 271 bb_simple_error_msg_and_die("need hardware address");
272 } 272 }
273 if (option_mask32 & ARP_OPT_D) { 273 if (option_mask32 & ARP_OPT_D) {
274 arp_getdevhw(*args++, &req.arp_ha); 274 arp_getdevhw(*args++, &req.arp_ha);
275 } else { 275 } else {
276 if (hw->input(*args++, &req.arp_ha) < 0) { 276 if (hw->input(*args++, &req.arp_ha) < 0) {
277 bb_error_msg_and_die("invalid hardware address"); 277 bb_simple_error_msg_and_die("invalid hardware address");
278 } 278 }
279 } 279 }
280 280
@@ -302,7 +302,7 @@ static int arp_set(char **args)
302#ifdef HAVE_ATF_DONTPUB 302#ifdef HAVE_ATF_DONTPUB
303 flags |= ATF_DONTPUB; 303 flags |= ATF_DONTPUB;
304#else 304#else
305 bb_error_msg("feature ATF_DONTPUB is not supported"); 305 bb_simple_error_msg("feature ATF_DONTPUB is not supported");
306#endif 306#endif
307 args++; 307 args++;
308 break; 308 break;
@@ -310,7 +310,7 @@ static int arp_set(char **args)
310#ifdef HAVE_ATF_MAGIC 310#ifdef HAVE_ATF_MAGIC
311 flags |= ATF_MAGIC; 311 flags |= ATF_MAGIC;
312#else 312#else
313 bb_error_msg("feature ATF_MAGIC is not supported"); 313 bb_simple_error_msg("feature ATF_MAGIC is not supported");
314#endif 314#endif
315 args++; 315 args++;
316 break; 316 break;
@@ -326,7 +326,7 @@ static int arp_set(char **args)
326 if (strcmp(*args, "255.255.255.255") != 0) { 326 if (strcmp(*args, "255.255.255.255") != 0) {
327 host = *args; 327 host = *args;
328 if (ap->input(host, &sa) < 0) { 328 if (ap->input(host, &sa) < 0) {
329 bb_herror_msg_and_die("%s", host); 329 bb_simple_herror_msg_and_die(host);
330 } 330 }
331 memcpy(&req.arp_netmask, &sa, sizeof(struct sockaddr)); 331 memcpy(&req.arp_netmask, &sa, sizeof(struct sockaddr));
332 flags |= ATF_NETMASK; 332 flags |= ATF_NETMASK;
@@ -346,7 +346,7 @@ static int arp_set(char **args)
346 346
347 /* Call the kernel. */ 347 /* Call the kernel. */
348 if (option_mask32 & ARP_OPT_v) 348 if (option_mask32 & ARP_OPT_v)
349 bb_error_msg("SIOCSARP()"); 349 bb_simple_error_msg("SIOCSARP()");
350 xioctl(sockfd, SIOCSARP, &req); 350 xioctl(sockfd, SIOCSARP, &req);
351 return 0; 351 return 0;
352} 352}
@@ -422,7 +422,7 @@ static int arp_show(char *name)
422 if (name != NULL) { 422 if (name != NULL) {
423 /* Resolve the host name. */ 423 /* Resolve the host name. */
424 if (ap->input(name, &sa) < 0) { 424 if (ap->input(name, &sa) < 0) {
425 bb_herror_msg_and_die("%s", name); 425 bb_simple_herror_msg_and_die(name);
426 } 426 }
427 host = xstrdup(ap->sprint(&sa, 1)); 427 host = xstrdup(ap->sprint(&sa, 1));
428 } 428 }
@@ -530,7 +530,7 @@ int arp_main(int argc UNUSED_PARAM, char **argv)
530 /* Now see what we have to do here... */ 530 /* Now see what we have to do here... */
531 if (opts & (ARP_OPT_d | ARP_OPT_s)) { 531 if (opts & (ARP_OPT_d | ARP_OPT_s)) {
532 if (argv[0] == NULL) 532 if (argv[0] == NULL)
533 bb_error_msg_and_die("need host name"); 533 bb_simple_error_msg_and_die("need host name");
534 if (opts & ARP_OPT_s) 534 if (opts & ARP_OPT_s)
535 return arp_set(argv); 535 return arp_set(argv);
536 return arp_del(argv); 536 return arp_del(argv);
diff --git a/networking/arping.c b/networking/arping.c
index 901578b68..2a256aaa0 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -375,7 +375,7 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
375 xconnect(probe_fd, (struct sockaddr *) &G.probe_saddr, sizeof(G.probe_saddr)); 375 xconnect(probe_fd, (struct sockaddr *) &G.probe_saddr, sizeof(G.probe_saddr));
376 bb_getsockname(probe_fd, (struct sockaddr *) &G.probe_saddr, sizeof(G.probe_saddr)); 376 bb_getsockname(probe_fd, (struct sockaddr *) &G.probe_saddr, sizeof(G.probe_saddr));
377 if (G.probe_saddr.sin_family != AF_INET) 377 if (G.probe_saddr.sin_family != AF_INET)
378 bb_error_msg_and_die("no IP address configured"); 378 bb_simple_error_msg_and_die("no IP address configured");
379 src = G.probe_saddr.sin_addr; 379 src = G.probe_saddr.sin_addr;
380 } 380 }
381 close(probe_fd); 381 close(probe_fd);
@@ -430,7 +430,7 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
430 /* Don't allow SIGALRMs while we process the reply */ 430 /* Don't allow SIGALRMs while we process the reply */
431 sigprocmask(SIG_BLOCK, &G.sset, NULL); 431 sigprocmask(SIG_BLOCK, &G.sset, NULL);
432 if (cc < 0) { 432 if (cc < 0) {
433 bb_perror_msg("recvfrom"); 433 bb_simple_perror_msg("recvfrom");
434 continue; 434 continue;
435 } 435 }
436 recv_pack(G.packet, cc, &from); 436 recv_pack(G.packet, cc, &from);
diff --git a/networking/dnsd.c b/networking/dnsd.c
index f2c6bddc6..0ff0290fb 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -395,11 +395,11 @@ static int process_packet(struct dns_entry *conf_data,
395 395
396 head = (struct dns_head *)buf; 396 head = (struct dns_head *)buf;
397 if (head->nquer == 0) { 397 if (head->nquer == 0) {
398 bb_error_msg("packet has 0 queries, ignored"); 398 bb_simple_error_msg("packet has 0 queries, ignored");
399 return 0; /* don't reply */ 399 return 0; /* don't reply */
400 } 400 }
401 if (head->flags & htons(0x8000)) { /* QR bit */ 401 if (head->flags & htons(0x8000)) { /* QR bit */
402 bb_error_msg("response packet, ignored"); 402 bb_simple_error_msg("response packet, ignored");
403 return 0; /* don't reply */ 403 return 0; /* don't reply */
404 } 404 }
405 /* QR = 1 "response", RCODE = 4 "Not Implemented" */ 405 /* QR = 1 "response", RCODE = 4 "Not Implemented" */
@@ -474,7 +474,7 @@ static int process_packet(struct dns_entry *conf_data,
474 * RCODE = 0 "success" 474 * RCODE = 0 "success"
475 */ 475 */
476 if (OPT_verbose) 476 if (OPT_verbose)
477 bb_info_msg("returning positive reply"); 477 bb_simple_info_msg("returning positive reply");
478 outr_flags = htons(0x8000 | 0x0400 | 0); 478 outr_flags = htons(0x8000 | 0x0400 | 0);
479 /* we have one answer */ 479 /* we have one answer */
480 head->nansw = htons(1); 480 head->nansw = htons(1);
@@ -557,7 +557,7 @@ int dnsd_main(int argc UNUSED_PARAM, char **argv)
557 continue; 557 continue;
558 } 558 }
559 if (OPT_verbose) 559 if (OPT_verbose)
560 bb_info_msg("got UDP packet"); 560 bb_simple_info_msg("got UDP packet");
561 buf[r] = '\0'; /* paranoia */ 561 buf[r] = '\0'; /* paranoia */
562 r = process_packet(conf_data, conf_ttl, buf); 562 r = process_packet(conf_data, conf_ttl, buf);
563 if (r <= 0) 563 if (r <= 0)
diff --git a/networking/ether-wake.c b/networking/ether-wake.c
index acaac16f8..f45d43609 100644
--- a/networking/ether-wake.c
+++ b/networking/ether-wake.c
@@ -182,7 +182,7 @@ static int get_wol_pw(const char *ethoptarg, unsigned char *wol_passwd)
182 byte_cnt = sscanf(ethoptarg, "%u.%u.%u.%u", 182 byte_cnt = sscanf(ethoptarg, "%u.%u.%u.%u",
183 &passwd[0], &passwd[1], &passwd[2], &passwd[3]); 183 &passwd[0], &passwd[1], &passwd[2], &passwd[3]);
184 if (byte_cnt < 4) { 184 if (byte_cnt < 4) {
185 bb_error_msg("can't read Wake-On-LAN pass"); 185 bb_simple_error_msg("can't read Wake-On-LAN pass");
186 return 0; 186 return 0;
187 } 187 }
188// TODO: check invalid numbers >255?? 188// TODO: check invalid numbers >255??
@@ -266,7 +266,7 @@ int ether_wake_main(int argc UNUSED_PARAM, char **argv)
266 /* This is necessary for broadcasts to work */ 266 /* This is necessary for broadcasts to work */
267 if (flags /* & 1 OPT_BROADCAST */) { 267 if (flags /* & 1 OPT_BROADCAST */) {
268 if (setsockopt_broadcast(s) != 0) 268 if (setsockopt_broadcast(s) != 0)
269 bb_perror_msg("SO_BROADCAST"); 269 bb_simple_perror_msg("SO_BROADCAST");
270 } 270 }
271 271
272#if defined(PF_PACKET) 272#if defined(PF_PACKET)
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index cb6910fb0..6f7f7e9ca 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -214,7 +214,7 @@ int ftp_receive(const char *local_path, char *server_path)
214 struct stat sbuf; 214 struct stat sbuf;
215 /* lstat would be wrong here! */ 215 /* lstat would be wrong here! */
216 if (stat(local_path, &sbuf) < 0) { 216 if (stat(local_path, &sbuf) < 0) {
217 bb_perror_msg_and_die("stat"); 217 bb_simple_perror_msg_and_die("stat");
218 } 218 }
219 if (sbuf.st_size > 0) { 219 if (sbuf.st_size > 0) {
220 beg_range = sbuf.st_size; 220 beg_range = sbuf.st_size;
diff --git a/networking/hostname.c b/networking/hostname.c
index 248d8b65a..f96daed95 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -61,7 +61,7 @@ static void do_sethostname(char *s, int isfile)
61 } else if (sethostname(s, strlen(s))) { 61 } else if (sethostname(s, strlen(s))) {
62// if (errno == EPERM) 62// if (errno == EPERM)
63// bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 63// bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
64 bb_perror_msg_and_die("sethostname"); 64 bb_simple_perror_msg_and_die("sethostname");
65 } 65 }
66} 66}
67 67
diff --git a/networking/httpd.c b/networking/httpd.c
index a0a4abc10..1757e09c9 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1025,7 +1025,7 @@ static void log_and_exit(void)
1025 */ 1025 */
1026 1026
1027 if (verbose > 2) 1027 if (verbose > 2)
1028 bb_error_msg("closed"); 1028 bb_simple_error_msg("closed");
1029 _exit(xfunc_error_retval); 1029 _exit(xfunc_error_retval);
1030} 1030}
1031 1031
@@ -1220,7 +1220,7 @@ static void send_headers(unsigned responseNum)
1220 } 1220 }
1221 if (full_write(STDOUT_FILENO, iobuf, len) != len) { 1221 if (full_write(STDOUT_FILENO, iobuf, len) != len) {
1222 if (verbose > 1) 1222 if (verbose > 1)
1223 bb_perror_msg("error"); 1223 bb_simple_perror_msg("error");
1224 log_and_exit(); 1224 log_and_exit();
1225 } 1225 }
1226} 1226}
@@ -1838,7 +1838,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
1838 if (count < 0) { 1838 if (count < 0) {
1839 IF_FEATURE_USE_SENDFILE(fin:) 1839 IF_FEATURE_USE_SENDFILE(fin:)
1840 if (verbose > 1) 1840 if (verbose > 1)
1841 bb_perror_msg("error"); 1841 bb_simple_perror_msg("error");
1842 } 1842 }
1843 log_and_exit(); 1843 log_and_exit();
1844} 1844}
@@ -2149,7 +2149,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
2149 if (rmt_ip_str) 2149 if (rmt_ip_str)
2150 applet_name = rmt_ip_str; 2150 applet_name = rmt_ip_str;
2151 if (verbose > 2) 2151 if (verbose > 2)
2152 bb_error_msg("connected"); 2152 bb_simple_error_msg("connected");
2153 } 2153 }
2154 if_ip_denied_send_HTTP_FORBIDDEN_and_exit(remote_ip); 2154 if_ip_denied_send_HTTP_FORBIDDEN_and_exit(remote_ip);
2155 2155
@@ -2746,7 +2746,7 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
2746 if (opt & OPT_SETUID) { 2746 if (opt & OPT_SETUID) {
2747 if (ugid.gid != (gid_t)-1) { 2747 if (ugid.gid != (gid_t)-1) {
2748 if (setgroups(1, &ugid.gid) == -1) 2748 if (setgroups(1, &ugid.gid) == -1)
2749 bb_perror_msg_and_die("setgroups"); 2749 bb_simple_perror_msg_and_die("setgroups");
2750 xsetgid(ugid.gid); 2750 xsetgid(ugid.gid);
2751 } 2751 }
2752 xsetuid(ugid.uid); 2752 xsetuid(ugid.uid);
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 5c47abc16..b566d91a9 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -361,7 +361,7 @@ int ifconfig_main(int argc UNUSED_PARAM, char **argv)
361#if ENABLE_FEATURE_IFCONFIG_STATUS 361#if ENABLE_FEATURE_IFCONFIG_STATUS
362 return display_interfaces(argv[0] ? argv[0] : show_all_param); 362 return display_interfaces(argv[0] ? argv[0] : show_all_param);
363#else 363#else
364 bb_error_msg_and_die("no support for status display"); 364 bb_simple_error_msg_and_die("no support for status display");
365#endif 365#endif
366 } 366 }
367 367
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index b7b26c113..fa18edd57 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -365,7 +365,7 @@ static void up_iface(void)
365 if (!(ifrequest.ifr_flags & IFF_UP)) { 365 if (!(ifrequest.ifr_flags & IFF_UP)) {
366 ifrequest.ifr_flags |= IFF_UP; 366 ifrequest.ifr_flags |= IFF_UP;
367 /* Let user know we mess up with interface */ 367 /* Let user know we mess up with interface */
368 bb_info_msg("upping interface"); 368 bb_simple_info_msg("upping interface");
369 if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) { 369 if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) {
370 if (errno != ENODEV && errno != EADDRNOTAVAIL) 370 if (errno != ENODEV && errno != EADDRNOTAVAIL)
371 xfunc_die(); 371 xfunc_die();
@@ -461,7 +461,7 @@ static smallint detect_link(void)
461 else if (option_mask32 & FLAG_IGNORE_FAIL_POSITIVE) 461 else if (option_mask32 & FLAG_IGNORE_FAIL_POSITIVE)
462 status = IFSTATUS_UP; 462 status = IFSTATUS_UP;
463 else if (G.api_mode[0] == 'a') 463 else if (G.api_mode[0] == 'a')
464 bb_error_msg("can't detect link status"); 464 bb_simple_error_msg("can't detect link status");
465 } 465 }
466 466
467 if (status != G.iface_last_status) { 467 if (status != G.iface_last_status) {
@@ -493,14 +493,14 @@ static NOINLINE int check_existence_through_netlink(void)
493 goto ret; 493 goto ret;
494 if (errno == EINTR) 494 if (errno == EINTR)
495 continue; 495 continue;
496 bb_perror_msg("netlink: recv"); 496 bb_simple_perror_msg("netlink: recv");
497 return -1; 497 return -1;
498 } 498 }
499 499
500 mhdr = (struct nlmsghdr*)replybuf; 500 mhdr = (struct nlmsghdr*)replybuf;
501 while (bytes > 0) { 501 while (bytes > 0) {
502 if (!NLMSG_OK(mhdr, bytes)) { 502 if (!NLMSG_OK(mhdr, bytes)) {
503 bb_error_msg("netlink packet too small or truncated"); 503 bb_simple_error_msg("netlink packet too small or truncated");
504 return -1; 504 return -1;
505 } 505 }
506 506
@@ -509,7 +509,7 @@ static NOINLINE int check_existence_through_netlink(void)
509 int attr_len; 509 int attr_len;
510 510
511 if (mhdr->nlmsg_len < NLMSG_LENGTH(sizeof(struct ifinfomsg))) { 511 if (mhdr->nlmsg_len < NLMSG_LENGTH(sizeof(struct ifinfomsg))) {
512 bb_error_msg("netlink packet too small or truncated"); 512 bb_simple_error_msg("netlink packet too small or truncated");
513 return -1; 513 return -1;
514 } 514 }
515 515
@@ -591,7 +591,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
591 } 591 }
592 592
593 if (pid_from_pidfile > 0 && kill(pid_from_pidfile, 0) == 0) 593 if (pid_from_pidfile > 0 && kill(pid_from_pidfile, 0) == 0)
594 bb_error_msg_and_die("daemon already running"); 594 bb_simple_error_msg_and_die("daemon already running");
595#endif 595#endif
596 596
597 api_mode_found = strchr(api_modes, G.api_mode[0]); 597 api_mode_found = strchr(api_modes, G.api_mode[0]);
@@ -690,7 +690,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
690 ) { 690 ) {
691 if (errno == EINTR) 691 if (errno == EINTR)
692 continue; 692 continue;
693 bb_perror_msg("poll"); 693 bb_simple_perror_msg("poll");
694 goto exiting; 694 goto exiting;
695 } 695 }
696 696
@@ -763,5 +763,5 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
763 763
764 exiting: 764 exiting:
765 remove_pidfile(pidfile_name); 765 remove_pidfile(pidfile_name);
766 bb_error_msg_and_die("exiting"); 766 bb_simple_error_msg_and_die("exiting");
767} 767}
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 5327b0979..60ceb5a1f 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -665,7 +665,7 @@ static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec)
665 if (executable_exists(ext_dhcp_clients[i].name)) 665 if (executable_exists(ext_dhcp_clients[i].name))
666 return execute(ext_dhcp_clients[i].startcmd, ifd, exec); 666 return execute(ext_dhcp_clients[i].startcmd, ifd, exec);
667 } 667 }
668 bb_error_msg("no dhcp clients found"); 668 bb_simple_error_msg("no dhcp clients found");
669 return 0; 669 return 0;
670} 670}
671# elif ENABLE_UDHCPC 671# elif ENABLE_UDHCPC
@@ -707,7 +707,7 @@ static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
707 } 707 }
708 708
709 if (!result) 709 if (!result)
710 bb_error_msg("warning: no dhcp clients found and stopped"); 710 bb_simple_error_msg("warning: no dhcp clients found and stopped");
711 711
712 /* Sleep a bit, otherwise static_down tries to bring down interface too soon, 712 /* Sleep a bit, otherwise static_down tries to bring down interface too soon,
713 and it may come back up because udhcpc is still shutting down */ 713 and it may come back up because udhcpc is still shutting down */
diff --git a/networking/inetd.c b/networking/inetd.c
index da6551174..3cd2b11f0 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -504,7 +504,7 @@ static void register_rpc(servtab_t *sep)
504 504
505 if (bb_getsockname(sep->se_fd, (struct sockaddr *) &ir_sin, sizeof(ir_sin)) < 0) { 505 if (bb_getsockname(sep->se_fd, (struct sockaddr *) &ir_sin, sizeof(ir_sin)) < 0) {
506//TODO: verify that such failure is even possible in Linux kernel 506//TODO: verify that such failure is even possible in Linux kernel
507 bb_perror_msg("getsockname"); 507 bb_simple_perror_msg("getsockname");
508 return; 508 return;
509 } 509 }
510 510
@@ -544,7 +544,7 @@ static void bump_nofile(void)
544 } 544 }
545 545
546 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) { 546 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
547 bb_perror_msg("setrlimit"); 547 bb_simple_perror_msg("setrlimit");
548 return; 548 return;
549 } 549 }
550 550
@@ -599,7 +599,7 @@ static void prepare_socket_fd(servtab_t *sep)
599 599
600 fd = socket(sep->se_family, sep->se_socktype, 0); 600 fd = socket(sep->se_family, sep->se_socktype, 0);
601 if (fd < 0) { 601 if (fd < 0) {
602 bb_perror_msg("socket"); 602 bb_simple_perror_msg("socket");
603 return; 603 return;
604 } 604 }
605 setsockopt_reuseaddr(fd); 605 setsockopt_reuseaddr(fd);
@@ -815,7 +815,7 @@ static NOINLINE servtab_t *parse_one_line(void)
815 n = bb_strtou(p, &p, 10); 815 n = bb_strtou(p, &p, 10);
816 if (n > INT_MAX) { 816 if (n > INT_MAX) {
817 bad_ver_spec: 817 bad_ver_spec:
818 bb_error_msg("bad rpc version"); 818 bb_simple_error_msg("bad rpc version");
819 goto parse_err; 819 goto parse_err;
820 } 820 }
821 sep->se_rpcver_lo = sep->se_rpcver_hi = n; 821 sep->se_rpcver_lo = sep->se_rpcver_hi = n;
@@ -829,7 +829,7 @@ static NOINLINE servtab_t *parse_one_line(void)
829 if (*p != '\0') 829 if (*p != '\0')
830 goto bad_ver_spec; 830 goto bad_ver_spec;
831#else 831#else
832 bb_error_msg("no support for rpc services"); 832 bb_simple_error_msg("no support for rpc services");
833 goto parse_err; 833 goto parse_err;
834#endif 834#endif
835 } 835 }
@@ -1235,7 +1235,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
1235 if (argv[0]) 1235 if (argv[0])
1236 config_filename = argv[0]; 1236 config_filename = argv[0];
1237 if (config_filename == NULL) 1237 if (config_filename == NULL)
1238 bb_error_msg_and_die("non-root must specify config file"); 1238 bb_simple_error_msg_and_die("non-root must specify config file");
1239 if (!(opt & 2)) 1239 if (!(opt & 2))
1240 bb_daemonize_or_rexec(0, argv - optind); 1240 bb_daemonize_or_rexec(0, argv - optind);
1241 else 1241 else
@@ -1304,7 +1304,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
1304 ready_fd_cnt = select(maxsock + 1, &readable, NULL, NULL, NULL); 1304 ready_fd_cnt = select(maxsock + 1, &readable, NULL, NULL, NULL);
1305 if (ready_fd_cnt < 0) { 1305 if (ready_fd_cnt < 0) {
1306 if (errno != EINTR) { 1306 if (errno != EINTR) {
1307 bb_perror_msg("select"); 1307 bb_simple_perror_msg("select");
1308 sleep(1); 1308 sleep(1);
1309 } 1309 }
1310 continue; 1310 continue;
@@ -1405,7 +1405,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
1405 pid = vfork(); 1405 pid = vfork();
1406 1406
1407 if (pid < 0) { /* fork error */ 1407 if (pid < 0) { /* fork error */
1408 bb_perror_msg("vfork"+1); 1408 bb_simple_perror_msg("vfork"+1);
1409 sleep(1); 1409 sleep(1);
1410 restore_sigmask(&omask); 1410 restore_sigmask(&omask);
1411 maybe_close(new_udp_fd); 1411 maybe_close(new_udp_fd);
@@ -1488,7 +1488,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
1488 } 1488 }
1489 if (real_uid != 0 && real_uid != pwd->pw_uid) { 1489 if (real_uid != 0 && real_uid != pwd->pw_uid) {
1490 /* a user running private inetd */ 1490 /* a user running private inetd */
1491 bb_error_msg("non-root must run services as himself"); 1491 bb_simple_error_msg("non-root must run services as himself");
1492 goto do_exit1; 1492 goto do_exit1;
1493 } 1493 }
1494 if (pwd->pw_uid != real_uid) { 1494 if (pwd->pw_uid != real_uid) {
@@ -1502,7 +1502,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
1502 } 1502 }
1503 if (rlim_ofile.rlim_cur != rlim_ofile_cur) 1503 if (rlim_ofile.rlim_cur != rlim_ofile_cur)
1504 if (setrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0) 1504 if (setrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0)
1505 bb_perror_msg("setrlimit"); 1505 bb_simple_perror_msg("setrlimit");
1506 1506
1507 /* closelog(); - WRONG. we are after vfork, 1507 /* closelog(); - WRONG. we are after vfork,
1508 * this may confuse syslog() internal state. 1508 * this may confuse syslog() internal state.
diff --git a/networking/ipcalc.c b/networking/ipcalc.c
index 67f768836..09b146872 100644
--- a/networking/ipcalc.c
+++ b/networking/ipcalc.c
@@ -183,7 +183,7 @@ int ipcalc_main(int argc UNUSED_PARAM, char **argv)
183 183
184 if (argv[1]) { 184 if (argv[1]) {
185 if (ENABLE_FEATURE_IPCALC_FANCY && have_netmask) { 185 if (ENABLE_FEATURE_IPCALC_FANCY && have_netmask) {
186 bb_error_msg_and_die("use prefix or netmask, not both"); 186 bb_simple_error_msg_and_die("use prefix or netmask, not both");
187 } 187 }
188 if (inet_aton(argv[1], &s_netmask) == 0) { 188 if (inet_aton(argv[1], &s_netmask) == 0) {
189 bb_error_msg_and_die("bad netmask: %s", argv[1]); 189 bb_error_msg_and_die("bad netmask: %s", argv[1]);
diff --git a/networking/isrv.c b/networking/isrv.c
index 97f5c6d4e..0e3f10f9a 100644
--- a/networking/isrv.c
+++ b/networking/isrv.c
@@ -185,7 +185,7 @@ static void handle_accept(isrv_state_t *state, int fd)
185 /* Most probably someone gave us wrong fd type 185 /* Most probably someone gave us wrong fd type
186 * (for example, non-socket). Don't want 186 * (for example, non-socket). Don't want
187 * to loop forever. */ 187 * to loop forever. */
188 bb_perror_msg_and_die("accept"); 188 bb_simple_perror_msg_and_die("accept");
189 } 189 }
190 190
191 DPRINTF("new_peer(%d)", newfd); 191 DPRINTF("new_peer(%d)", newfd);
@@ -311,7 +311,7 @@ void isrv_run(
311 311
312 if (n < 0) { 312 if (n < 0) {
313 if (errno != EINTR) 313 if (errno != EINTR)
314 bb_perror_msg("select"); 314 bb_simple_perror_msg("select");
315 continue; 315 continue;
316 } 316 }
317 317
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index 7b7e0154b..86cf3beea 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -119,7 +119,7 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n)
119 //memset(tb, 0, sizeof(tb)); - parse_rtattr does this 119 //memset(tb, 0, sizeof(tb)); - parse_rtattr does this
120 parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); 120 parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
121 if (tb[IFLA_IFNAME] == NULL) { 121 if (tb[IFLA_IFNAME] == NULL) {
122 bb_error_msg("nil ifname"); 122 bb_simple_error_msg("nil ifname");
123 return -1; 123 return -1;
124 } 124 }
125 if (G_filter.label 125 if (G_filter.label
@@ -205,7 +205,7 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n)
205static int flush_update(void) 205static int flush_update(void)
206{ 206{
207 if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) { 207 if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) {
208 bb_perror_msg("can't send flush request"); 208 bb_simple_perror_msg("can't send flush request");
209 return -1; 209 return -1;
210 } 210 }
211 G_filter.flushp = 0; 211 G_filter.flushp = 0;
@@ -439,7 +439,7 @@ int FAST_FUNC ipaddr_list_or_flush(char **argv, int flush)
439 bb_error_msg_and_die(bb_msg_requires_arg, "flush"); 439 bb_error_msg_and_die(bb_msg_requires_arg, "flush");
440 } 440 }
441 if (G_filter.family == AF_PACKET) { 441 if (G_filter.family == AF_PACKET) {
442 bb_error_msg_and_die("can't flush link addresses"); 442 bb_simple_error_msg_and_die("can't flush link addresses");
443 } 443 }
444 } 444 }
445 445
@@ -700,7 +700,7 @@ static int ipaddr_modify(int cmd, int flags, char **argv)
700 700
701 if (!d) { 701 if (!d) {
702 /* There was no "dev IFACE", but we need that */ 702 /* There was no "dev IFACE", but we need that */
703 bb_error_msg_and_die("need \"dev IFACE\""); 703 bb_simple_error_msg_and_die("need \"dev IFACE\"");
704 } 704 }
705 if (l && !is_prefixed_with(l, d)) { 705 if (l && !is_prefixed_with(l, d)) {
706 bb_error_msg_and_die("\"dev\" (%s) must match \"label\" (%s)", d, l); 706 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)
717 inet_prefix brd; 717 inet_prefix brd;
718 int i; 718 int i;
719 if (req.ifa.ifa_family != AF_INET) { 719 if (req.ifa.ifa_family != AF_INET) {
720 bb_error_msg_and_die("broadcast can be set only for IPv4 addresses"); 720 bb_simple_error_msg_and_die("broadcast can be set only for IPv4 addresses");
721 } 721 }
722 brd = peer; 722 brd = peer;
723 if (brd.bitlen <= 30) { 723 if (brd.bitlen <= 30) {
diff --git a/networking/libiproute/ipneigh.c b/networking/libiproute/ipneigh.c
index 984dd4bdd..b9b4f4b31 100644
--- a/networking/libiproute/ipneigh.c
+++ b/networking/libiproute/ipneigh.c
@@ -49,7 +49,7 @@ typedef struct filter_t filter_t;
49static int flush_update(void) 49static int flush_update(void)
50{ 50{
51 if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) { 51 if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) {
52 bb_perror_msg("can't send flush request"); 52 bb_simple_perror_msg("can't send flush request");
53 return -1; 53 return -1;
54 } 54 }
55 G_filter.flushp = 0; 55 G_filter.flushp = 0;
@@ -305,7 +305,7 @@ static int FAST_FUNC ipneigh_list_or_flush(char **argv, int flush)
305 xrtnl_wilddump_request(&rth, G_filter.family, RTM_GETNEIGH); 305 xrtnl_wilddump_request(&rth, G_filter.family, RTM_GETNEIGH);
306 G_filter.flushed = 0; 306 G_filter.flushed = 0;
307 if (xrtnl_dump_filter(&rth, print_neigh, NULL) < 0) { 307 if (xrtnl_dump_filter(&rth, print_neigh, NULL) < 0) {
308 bb_perror_msg_and_die("flush terminated"); 308 bb_simple_perror_msg_and_die("flush terminated");
309 } 309 }
310 if (G_filter.flushed == 0) { 310 if (G_filter.flushed == 0) {
311 if (round == 0) 311 if (round == 0)
@@ -325,11 +325,11 @@ static int FAST_FUNC ipneigh_list_or_flush(char **argv, int flush)
325 ndm.ndm_family = G_filter.family; 325 ndm.ndm_family = G_filter.family;
326 326
327 if (rtnl_dump_request(&rth, RTM_GETNEIGH, &ndm, sizeof(struct ndmsg)) < 0) { 327 if (rtnl_dump_request(&rth, RTM_GETNEIGH, &ndm, sizeof(struct ndmsg)) < 0) {
328 bb_perror_msg_and_die("can't send dump request"); 328 bb_simple_perror_msg_and_die("can't send dump request");
329 } 329 }
330 330
331 if (xrtnl_dump_filter(&rth, print_neigh, NULL) < 0) { 331 if (xrtnl_dump_filter(&rth, print_neigh, NULL) < 0) {
332 bb_error_msg_and_die("dump terminated"); 332 bb_simple_error_msg_and_die("dump terminated");
333 } 333 }
334 334
335 return 0; 335 return 0;
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index b11078ed5..5a972f8b2 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -57,7 +57,7 @@ typedef struct filter_t filter_t;
57static int flush_update(void) 57static int flush_update(void)
58{ 58{
59 if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) { 59 if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) {
60 bb_perror_msg("can't send flush request"); 60 bb_simple_perror_msg("can't send flush request");
61 return -1; 61 return -1;
62 } 62 }
63 G_filter.flushp = 0; 63 G_filter.flushp = 0;
@@ -756,7 +756,7 @@ static void iproute_flush_cache(void)
756 } 756 }
757 757
758 if (write(flush_fd, "-1", 2) < 2) { 758 if (write(flush_fd, "-1", 2) < 2) {
759 bb_perror_msg("can't flush routing cache"); 759 bb_simple_perror_msg("can't flush routing cache");
760 return; 760 return;
761 } 761 }
762 close(flush_fd); 762 close(flush_fd);
@@ -948,7 +948,7 @@ static int iproute_list_or_flush(char **argv, int flush)
948 if (G_filter.tb != -1) { 948 if (G_filter.tb != -1) {
949 xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE); 949 xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE);
950 } else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) { 950 } else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) {
951 bb_perror_msg_and_die("can't send dump request"); 951 bb_simple_perror_msg_and_die("can't send dump request");
952 } 952 }
953 xrtnl_dump_filter(&rth, print_route, NULL); 953 xrtnl_dump_filter(&rth, print_route, NULL);
954 954
@@ -1041,7 +1041,7 @@ static int iproute_get(char **argv)
1041 } 1041 }
1042 1042
1043 if (req.r.rtm_dst_len == 0) { 1043 if (req.r.rtm_dst_len == 0) {
1044 bb_error_msg_and_die("need at least destination address"); 1044 bb_simple_error_msg_and_die("need at least destination address");
1045 } 1045 }
1046 1046
1047 xrtnl_open(&rth); 1047 xrtnl_open(&rth);
@@ -1077,7 +1077,7 @@ static int iproute_get(char **argv)
1077 print_route(NULL, &req.n, NULL); 1077 print_route(NULL, &req.n, NULL);
1078 1078
1079 if (req.n.nlmsg_type != RTM_NEWROUTE) { 1079 if (req.n.nlmsg_type != RTM_NEWROUTE) {
1080 bb_error_msg_and_die("not a route?"); 1080 bb_simple_error_msg_and_die("not a route?");
1081 } 1081 }
1082 len -= NLMSG_LENGTH(sizeof(*r)); 1082 len -= NLMSG_LENGTH(sizeof(*r));
1083 if (len < 0) { 1083 if (len < 0) {
@@ -1091,7 +1091,7 @@ static int iproute_get(char **argv)
1091 tb[RTA_PREFSRC]->rta_type = RTA_SRC; 1091 tb[RTA_PREFSRC]->rta_type = RTA_SRC;
1092 r->rtm_src_len = 8*RTA_PAYLOAD(tb[RTA_PREFSRC]); 1092 r->rtm_src_len = 8*RTA_PAYLOAD(tb[RTA_PREFSRC]);
1093 } else if (!tb[RTA_SRC]) { 1093 } else if (!tb[RTA_SRC]) {
1094 bb_error_msg_and_die("can't connect the route"); 1094 bb_simple_error_msg_and_die("can't connect the route");
1095 } 1095 }
1096 if (!odev && tb[RTA_OIF]) { 1096 if (!odev && tb[RTA_OIF]) {
1097 tb[RTA_OIF]->rta_type = 0; 1097 tb[RTA_OIF]->rta_type = 0;
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c
index 4002feb78..c9fa632f3 100644
--- a/networking/libiproute/iptunnel.c
+++ b/networking/libiproute/iptunnel.c
@@ -338,7 +338,7 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p)
338 338
339 if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) { 339 if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) {
340 if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) { 340 if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {
341 bb_error_msg_and_die("keys are not allowed with ipip and sit"); 341 bb_simple_error_msg_and_die("keys are not allowed with ipip and sit");
342 } 342 }
343 } 343 }
344 344
@@ -355,7 +355,7 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p)
355 p->o_flags |= GRE_KEY; 355 p->o_flags |= GRE_KEY;
356 } 356 }
357 if (IN_MULTICAST(ntohl(p->iph.daddr)) && !p->iph.saddr) { 357 if (IN_MULTICAST(ntohl(p->iph.daddr)) && !p->iph.saddr) {
358 bb_error_msg_and_die("broadcast tunnel requires a source address"); 358 bb_simple_error_msg_and_die("broadcast tunnel requires a source address");
359 } 359 }
360} 360}
361 361
@@ -367,7 +367,7 @@ static int do_add(int cmd, char **argv)
367 parse_args(argv, cmd, &p); 367 parse_args(argv, cmd, &p);
368 368
369 if (p.iph.ttl && p.iph.frag_off == 0) { 369 if (p.iph.ttl && p.iph.frag_off == 0) {
370 bb_error_msg_and_die("ttl != 0 and noptmudisc are incompatible"); 370 bb_simple_error_msg_and_die("ttl != 0 and noptmudisc are incompatible");
371 } 371 }
372 372
373 switch (p.iph.protocol) { 373 switch (p.iph.protocol) {
@@ -378,7 +378,7 @@ static int do_add(int cmd, char **argv)
378 case IPPROTO_IPV6: 378 case IPPROTO_IPV6:
379 return do_add_ioctl(cmd, "sit0", &p); 379 return do_add_ioctl(cmd, "sit0", &p);
380 default: 380 default:
381 bb_error_msg_and_die("can't determine tunnel mode (ipip, gre or sit)"); 381 bb_simple_error_msg_and_die("can't determine tunnel mode (ipip, gre or sit)");
382 } 382 }
383} 383}
384 384
@@ -485,7 +485,7 @@ static void do_tunnels_list(struct ip_tunnel_parm *p)
485 if (ptr == NULL || 485 if (ptr == NULL ||
486 (*ptr++ = 0, sscanf(buf, "%s", name) != 1) 486 (*ptr++ = 0, sscanf(buf, "%s", name) != 1)
487 ) { 487 ) {
488 bb_error_msg("wrong format of /proc/net/dev"); 488 bb_simple_error_msg("wrong format of /proc/net/dev");
489 return; 489 return;
490 } 490 }
491 if (sscanf(ptr, "%lu%lu%lu%lu%lu%lu%lu%*d%lu%lu%lu%lu%lu%lu%lu", 491 if (sscanf(ptr, "%lu%lu%lu%lu%lu%lu%lu%*d%lu%lu%lu%lu%lu%lu%lu",
diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c
index b0d4166ac..7e3473a1c 100644
--- a/networking/libiproute/libnetlink.c
+++ b/networking/libiproute/libnetlink.c
@@ -79,7 +79,7 @@ int FAST_FUNC rtnl_send_check(struct rtnl_handle *rth, const void *buf, int len)
79 if (h->nlmsg_type == NLMSG_ERROR) { 79 if (h->nlmsg_type == NLMSG_ERROR) {
80 struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); 80 struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
81 if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) 81 if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr)))
82 bb_error_msg("ERROR truncated"); 82 bb_simple_error_msg("ERROR truncated");
83 else 83 else
84 errno = -err->error; 84 errno = -err->error;
85 return -1; 85 return -1;
@@ -149,11 +149,11 @@ static int rtnl_dump_filter(struct rtnl_handle *rth,
149 if (status < 0) { 149 if (status < 0) {
150 if (errno == EINTR) 150 if (errno == EINTR)
151 continue; 151 continue;
152 bb_perror_msg("OVERRUN"); 152 bb_simple_perror_msg("OVERRUN");
153 continue; 153 continue;
154 } 154 }
155 if (status == 0) { 155 if (status == 0) {
156 bb_error_msg("EOF on netlink"); 156 bb_simple_error_msg("EOF on netlink");
157 goto ret; 157 goto ret;
158 } 158 }
159 if (msg.msg_namelen != sizeof(nladdr)) { 159 if (msg.msg_namelen != sizeof(nladdr)) {
@@ -184,10 +184,10 @@ static int rtnl_dump_filter(struct rtnl_handle *rth,
184 if (h->nlmsg_type == NLMSG_ERROR) { 184 if (h->nlmsg_type == NLMSG_ERROR) {
185 struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h); 185 struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h);
186 if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) { 186 if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
187 bb_error_msg("ERROR truncated"); 187 bb_simple_error_msg("ERROR truncated");
188 } else { 188 } else {
189 errno = -l_err->error; 189 errno = -l_err->error;
190 bb_perror_msg("RTNETLINK answers"); 190 bb_simple_perror_msg("RTNETLINK answers");
191 } 191 }
192 goto ret; 192 goto ret;
193 } 193 }
@@ -201,7 +201,7 @@ static int rtnl_dump_filter(struct rtnl_handle *rth,
201 h = NLMSG_NEXT(h, status); 201 h = NLMSG_NEXT(h, status);
202 } 202 }
203 if (msg.msg_flags & MSG_TRUNC) { 203 if (msg.msg_flags & MSG_TRUNC) {
204 bb_error_msg("message truncated"); 204 bb_simple_error_msg("message truncated");
205 continue; 205 continue;
206 } 206 }
207 if (status) { 207 if (status) {
@@ -221,7 +221,7 @@ int FAST_FUNC xrtnl_dump_filter(struct rtnl_handle *rth,
221{ 221{
222 int ret = rtnl_dump_filter(rth, filter, arg1/*, NULL, NULL*/); 222 int ret = rtnl_dump_filter(rth, filter, arg1/*, NULL, NULL*/);
223 if (ret < 0) 223 if (ret < 0)
224 bb_error_msg_and_die("dump terminated"); 224 bb_simple_error_msg_and_die("dump terminated");
225 return ret; 225 return ret;
226} 226}
227 227
@@ -266,7 +266,7 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
266 status = sendmsg(rtnl->fd, &msg, 0); 266 status = sendmsg(rtnl->fd, &msg, 0);
267 267
268 if (status < 0) { 268 if (status < 0) {
269 bb_perror_msg("can't talk to rtnetlink"); 269 bb_simple_perror_msg("can't talk to rtnetlink");
270 goto ret; 270 goto ret;
271 } 271 }
272 272
@@ -280,11 +280,11 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
280 if (errno == EINTR) { 280 if (errno == EINTR) {
281 continue; 281 continue;
282 } 282 }
283 bb_perror_msg("OVERRUN"); 283 bb_simple_perror_msg("OVERRUN");
284 continue; 284 continue;
285 } 285 }
286 if (status == 0) { 286 if (status == 0) {
287 bb_error_msg("EOF on netlink"); 287 bb_simple_error_msg("EOF on netlink");
288 goto ret; 288 goto ret;
289 } 289 }
290 if (msg.msg_namelen != sizeof(nladdr)) { 290 if (msg.msg_namelen != sizeof(nladdr)) {
@@ -297,7 +297,7 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
297 297
298 if (l < 0 || len > status) { 298 if (l < 0 || len > status) {
299 if (msg.msg_flags & MSG_TRUNC) { 299 if (msg.msg_flags & MSG_TRUNC) {
300 bb_error_msg("truncated message"); 300 bb_simple_error_msg("truncated message");
301 goto ret; 301 goto ret;
302 } 302 }
303 bb_error_msg_and_die("malformed message: len=%d!", len); 303 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,
320 if (h->nlmsg_type == NLMSG_ERROR) { 320 if (h->nlmsg_type == NLMSG_ERROR) {
321 struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); 321 struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
322 if (l < (int)sizeof(struct nlmsgerr)) { 322 if (l < (int)sizeof(struct nlmsgerr)) {
323 bb_error_msg("ERROR truncated"); 323 bb_simple_error_msg("ERROR truncated");
324 } else { 324 } else {
325 errno = - err->error; 325 errno = - err->error;
326 if (errno == 0) { 326 if (errno == 0) {
@@ -329,7 +329,7 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
329 } 329 }
330 goto ret_0; 330 goto ret_0;
331 } 331 }
332 bb_perror_msg("RTNETLINK answers"); 332 bb_simple_perror_msg("RTNETLINK answers");
333 } 333 }
334 goto ret; 334 goto ret;
335 } 335 }
@@ -338,13 +338,13 @@ int FAST_FUNC rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
338 goto ret_0; 338 goto ret_0;
339 } 339 }
340 340
341 bb_error_msg("unexpected reply!"); 341 bb_simple_error_msg("unexpected reply!");
342 342
343 status -= NLMSG_ALIGN(len); 343 status -= NLMSG_ALIGN(len);
344 h = (struct nlmsghdr*)((char*)h + NLMSG_ALIGN(len)); 344 h = (struct nlmsghdr*)((char*)h + NLMSG_ALIGN(len));
345 } 345 }
346 if (msg.msg_flags & MSG_TRUNC) { 346 if (msg.msg_flags & MSG_TRUNC) {
347 bb_error_msg("message truncated"); 347 bb_simple_error_msg("message truncated");
348 continue; 348 continue;
349 } 349 }
350 if (status) { 350 if (status) {
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index bf053a54b..4ce230356 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -230,7 +230,7 @@ uint32_t FAST_FUNC get_addr32(char *name)
230char** FAST_FUNC next_arg(char **argv) 230char** FAST_FUNC next_arg(char **argv)
231{ 231{
232 if (!*++argv) 232 if (!*++argv)
233 bb_error_msg_and_die("command line is not complete, try \"help\""); 233 bb_simple_error_msg_and_die("command line is not complete, try \"help\"");
234 return argv; 234 return argv;
235} 235}
236 236
diff --git a/networking/nbd-client.c b/networking/nbd-client.c
index 0dc8d0c43..3db3b46f9 100644
--- a/networking/nbd-client.c
+++ b/networking/nbd-client.c
@@ -179,7 +179,7 @@ int nbdclient_main(int argc, char **argv)
179 if (memcmp(&nbd_header.magic1, "NBDMAGIC", 179 if (memcmp(&nbd_header.magic1, "NBDMAGIC",
180 sizeof(nbd_header.magic1)) != 0 180 sizeof(nbd_header.magic1)) != 0
181 ) { 181 ) {
182 bb_error_msg_and_die("login failed"); 182 bb_simple_error_msg_and_die("login failed");
183 } 183 }
184 if (memcmp(&nbd_header.magic2, 184 if (memcmp(&nbd_header.magic2,
185 "\x00\x00\x42\x02\x81\x86\x12\x53", 185 "\x00\x00\x42\x02\x81\x86\x12\x53",
@@ -189,7 +189,7 @@ int nbdclient_main(int argc, char **argv)
189 } else if (memcmp(&nbd_header.magic2, "IHAVEOPT", 8) == 0) { 189 } else if (memcmp(&nbd_header.magic2, "IHAVEOPT", 8) == 0) {
190 proto_new = 1; 190 proto_new = 1;
191 } else { 191 } else {
192 bb_error_msg_and_die("login failed"); 192 bb_simple_error_msg_and_die("login failed");
193 } 193 }
194 194
195 if (!proto_new) { 195 if (!proto_new) {
@@ -240,17 +240,17 @@ int nbdclient_main(int argc, char **argv)
240 } 240 }
241 241
242 if (ioctl(nbd, BLKROSET, &ro) < 0) { 242 if (ioctl(nbd, BLKROSET, &ro) < 0) {
243 bb_perror_msg_and_die("BLKROSET"); 243 bb_simple_perror_msg_and_die("BLKROSET");
244 } 244 }
245 245
246 if (timeout) { 246 if (timeout) {
247 if (ioctl(nbd, NBD_SET_TIMEOUT, (unsigned long) timeout)) { 247 if (ioctl(nbd, NBD_SET_TIMEOUT, (unsigned long) timeout)) {
248 bb_perror_msg_and_die("NBD_SET_TIMEOUT"); 248 bb_simple_perror_msg_and_die("NBD_SET_TIMEOUT");
249 } 249 }
250 } 250 }
251 251
252 if (ioctl(nbd, NBD_SET_SOCK, sock)) { 252 if (ioctl(nbd, NBD_SET_SOCK, sock)) {
253 bb_perror_msg_and_die("NBD_SET_SOCK"); 253 bb_simple_perror_msg_and_die("NBD_SET_SOCK");
254 } 254 }
255 255
256 //if (swap) mlockall(MCL_CURRENT|MCL_FUTURE); 256 //if (swap) mlockall(MCL_CURRENT|MCL_FUTURE);
diff --git a/networking/nc.c b/networking/nc.c
index b208f46c6..705b7356a 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -112,7 +112,7 @@
112 112
113static void timeout(int signum UNUSED_PARAM) 113static void timeout(int signum UNUSED_PARAM)
114{ 114{
115 bb_error_msg_and_die("timed out"); 115 bb_simple_error_msg_and_die("timed out");
116} 116}
117 117
118int nc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 118int nc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -211,7 +211,7 @@ int nc_main(int argc, char **argv)
211 accept_again: 211 accept_again:
212 cfd = accept(sfd, NULL, 0); 212 cfd = accept(sfd, NULL, 0);
213 if (cfd < 0) 213 if (cfd < 0)
214 bb_perror_msg_and_die("accept"); 214 bb_simple_perror_msg_and_die("accept");
215 if (!execparam) 215 if (!execparam)
216 close(sfd); 216 close(sfd);
217 } else { 217 } else {
@@ -260,7 +260,7 @@ int nc_main(int argc, char **argv)
260 int nread; 260 int nread;
261 261
262 if (safe_poll(pfds, 2, -1) < 0) 262 if (safe_poll(pfds, 2, -1) < 0)
263 bb_perror_msg_and_die("poll"); 263 bb_simple_perror_msg_and_die("poll");
264 264
265 fdidx = 0; 265 fdidx = 0;
266 while (1) { 266 while (1) {
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index 42c84de45..034e03d21 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -198,8 +198,8 @@ enum {
198#define Debug(...) do { } while (0) 198#define Debug(...) do { } while (0)
199#endif 199#endif
200 200
201#define holler_error(...) do { if (o_verbose) bb_error_msg(__VA_ARGS__); } while (0) 201#define holler_error(msg) do { if (o_verbose) bb_simple_error_msg(msg); } while (0)
202#define holler_perror(...) do { if (o_verbose) bb_perror_msg(__VA_ARGS__); } while (0) 202#define holler_perror(msg) do { if (o_verbose) bb_simple_perror_msg(msg); } while (0)
203 203
204/* catch: no-brainer interrupt handler */ 204/* catch: no-brainer interrupt handler */
205static void catch(int sig) 205static void catch(int sig)
@@ -361,10 +361,10 @@ static void dolisten(int is_persistent, char **proggie)
361 rr = recv_from_to(netfd, NULL, 0, MSG_PEEK, /*was bigbuf_net, BIGSIZ*/ 361 rr = recv_from_to(netfd, NULL, 0, MSG_PEEK, /*was bigbuf_net, BIGSIZ*/
362 &remend.u.sa, &ouraddr->u.sa, ouraddr->len); 362 &remend.u.sa, &ouraddr->u.sa, ouraddr->len);
363 if (rr < 0) 363 if (rr < 0)
364 bb_perror_msg_and_die("recvfrom"); 364 bb_simple_perror_msg_and_die("recvfrom");
365 unarm(); 365 unarm();
366 } else 366 } else
367 bb_error_msg_and_die("timeout"); 367 bb_simple_error_msg_and_die("timeout");
368/* Now we learned *to which IP* peer has connected, and we want to anchor 368/* Now we learned *to which IP* peer has connected, and we want to anchor
369our socket on it, so that our outbound packets will have correct local IP. 369our socket on it, so that our outbound packets will have correct local IP.
370Unfortunately, bind() on already bound socket will fail now (EINVAL): 370Unfortunately, bind() on already bound socket will fail now (EINVAL):
@@ -382,7 +382,7 @@ create new one, and bind() it. TODO */
382 remend.len = LSA_SIZEOF_SA; 382 remend.len = LSA_SIZEOF_SA;
383 rr = accept(netfd, &remend.u.sa, &remend.len); 383 rr = accept(netfd, &remend.u.sa, &remend.len);
384 if (rr < 0) 384 if (rr < 0)
385 bb_perror_msg_and_die("accept"); 385 bb_simple_perror_msg_and_die("accept");
386 if (themaddr) { 386 if (themaddr) {
387 int sv_port, port, r; 387 int sv_port, port, r;
388 388
@@ -409,7 +409,7 @@ create new one, and bind() it. TODO */
409 } 409 }
410 unarm(); 410 unarm();
411 } else 411 } else
412 bb_error_msg_and_die("timeout"); 412 bb_simple_error_msg_and_die("timeout");
413 413
414 if (is_persistent && proggie) { 414 if (is_persistent && proggie) {
415 /* -l -k -e PROG */ 415 /* -l -k -e PROG */
@@ -494,7 +494,7 @@ static int udptest(void)
494 494
495 rr = write(netfd, bigbuf_in, 1); 495 rr = write(netfd, bigbuf_in, 1);
496 if (rr != 1) 496 if (rr != 1)
497 bb_perror_msg("udptest first write"); 497 bb_simple_perror_msg("udptest first write");
498 498
499 if (o_wait) 499 if (o_wait)
500 sleep(o_wait); // can be interrupted! while (t) nanosleep(&t)? 500 sleep(o_wait); // can be interrupted! while (t) nanosleep(&t)?
@@ -644,7 +644,7 @@ static int readwrite(void)
644 if (rr <= 0) { 644 if (rr <= 0) {
645 if (rr < 0 && o_verbose > 1) { 645 if (rr < 0 && o_verbose > 1) {
646 /* nc 1.10 doesn't do this */ 646 /* nc 1.10 doesn't do this */
647 bb_perror_msg("net read"); 647 bb_simple_perror_msg("net read");
648 } 648 }
649 pfds[1].fd = -1; /* don't poll for netfd anymore */ 649 pfds[1].fd = -1; /* don't poll for netfd anymore */
650 fds_open--; 650 fds_open--;
@@ -869,7 +869,7 @@ int nc_main(int argc UNUSED_PARAM, char **argv)
869 /* apparently UDP can listen ON "port 0", 869 /* apparently UDP can listen ON "port 0",
870 but that's not useful */ 870 but that's not useful */
871 if (!o_lport) 871 if (!o_lport)
872 bb_error_msg_and_die("UDP listen needs nonzero -p port"); 872 bb_simple_error_msg_and_die("UDP listen needs nonzero -p port");
873 } 873 }
874#endif 874#endif
875 875
diff --git a/networking/netstat.c b/networking/netstat.c
index f6bcd44ba..29b891cdc 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -343,9 +343,9 @@ static void prg_cache_load(void)
343 return; 343 return;
344 344
345 if (prg_cache_loaded == 1) 345 if (prg_cache_loaded == 1)
346 bb_error_msg("can't scan /proc - are you root?"); 346 bb_simple_error_msg("can't scan /proc - are you root?");
347 else 347 else
348 bb_error_msg("showing only processes with your user ID"); 348 bb_simple_error_msg("showing only processes with your user ID");
349} 349}
350 350
351#else 351#else
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 24e09d4f0..8adde14b8 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -549,7 +549,7 @@ static int send_queries(struct ns *ns)
549 549
550 recvlen = read(pfd.fd, reply, sizeof(reply)); 550 recvlen = read(pfd.fd, reply, sizeof(reply));
551 if (recvlen < 0) { 551 if (recvlen < 0) {
552 bb_perror_msg("read"); 552 bb_simple_perror_msg("read");
553 next: 553 next:
554 tcur = monotonic_ms(); 554 tcur = monotonic_ms();
555 continue; 555 continue;
diff --git a/networking/ntpd.c b/networking/ntpd.c
index d55b070c5..2700cf515 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -905,7 +905,7 @@ do_sendto(int fd,
905 ret = send_to_from(fd, msg, len, MSG_DONTWAIT, to, from, addrlen); 905 ret = send_to_from(fd, msg, len, MSG_DONTWAIT, to, from, addrlen);
906 } 906 }
907 if (ret != len) { 907 if (ret != len) {
908 bb_perror_msg("send failed"); 908 bb_simple_perror_msg("send failed");
909 return -1; 909 return -1;
910 } 910 }
911 return 0; 911 return 0;
@@ -1121,7 +1121,7 @@ step_time(double offset)
1121 dtime = tvc.tv_sec + (1.0e-6 * tvc.tv_usec) + offset; 1121 dtime = tvc.tv_sec + (1.0e-6 * tvc.tv_usec) + offset;
1122 d_to_tv(dtime, &tvn); 1122 d_to_tv(dtime, &tvn);
1123 if (settimeofday(&tvn, NULL) == -1) 1123 if (settimeofday(&tvn, NULL) == -1)
1124 bb_perror_msg_and_die("settimeofday"); 1124 bb_simple_perror_msg_and_die("settimeofday");
1125 1125
1126 VERB2 { 1126 VERB2 {
1127 tval = tvc.tv_sec; 1127 tval = tvc.tv_sec;
@@ -1494,7 +1494,7 @@ select_and_cluster(void)
1494 /* Starting from 1 is ok here */ 1494 /* Starting from 1 is ok here */
1495 for (i = 1; i < num_survivors; i++) { 1495 for (i = 1; i < num_survivors; i++) {
1496 if (G.last_update_peer == survivor[i].p) { 1496 if (G.last_update_peer == survivor[i].p) {
1497 VERB5 bb_error_msg("keeping old synced peer"); 1497 VERB5 bb_simple_error_msg("keeping old synced peer");
1498 p = G.last_update_peer; 1498 p = G.last_update_peer;
1499 goto keep_old; 1499 goto keep_old;
1500 } 1500 }
@@ -1702,7 +1702,7 @@ update_local_clock(peer_t *p)
1702#else 1702#else
1703 set_new_values(STATE_SYNC, offset, recv_time); 1703 set_new_values(STATE_SYNC, offset, recv_time);
1704#endif 1704#endif
1705 VERB4 bb_error_msg("transitioning to FREQ, datapoint ignored"); 1705 VERB4 bb_simple_error_msg("transitioning to FREQ, datapoint ignored");
1706 return 0; /* "leave poll interval as is" */ 1706 return 0; /* "leave poll interval as is" */
1707 1707
1708#if 0 /* this is dead code for now */ 1708#if 0 /* this is dead code for now */
@@ -1796,7 +1796,7 @@ update_local_clock(peer_t *p)
1796 VERB4 { 1796 VERB4 {
1797 memset(&tmx, 0, sizeof(tmx)); 1797 memset(&tmx, 0, sizeof(tmx));
1798 if (adjtimex(&tmx) < 0) 1798 if (adjtimex(&tmx) < 0)
1799 bb_perror_msg_and_die("adjtimex"); 1799 bb_simple_perror_msg_and_die("adjtimex");
1800 bb_error_msg("p adjtimex freq:%ld offset:%+ld status:0x%x tc:%ld", 1800 bb_error_msg("p adjtimex freq:%ld offset:%+ld status:0x%x tc:%ld",
1801 tmx.freq, tmx.offset, tmx.status, tmx.constant); 1801 tmx.freq, tmx.offset, tmx.status, tmx.constant);
1802 } 1802 }
@@ -1906,7 +1906,7 @@ update_local_clock(peer_t *p)
1906 //tmx.maxerror = (uint32_t)((sys_rootdelay / 2 + sys_rootdisp) * 1e6); 1906 //tmx.maxerror = (uint32_t)((sys_rootdelay / 2 + sys_rootdisp) * 1e6);
1907 rc = adjtimex(&tmx); 1907 rc = adjtimex(&tmx);
1908 if (rc < 0) 1908 if (rc < 0)
1909 bb_perror_msg_and_die("adjtimex"); 1909 bb_simple_perror_msg_and_die("adjtimex");
1910 /* NB: here kernel returns constant == G.poll_exp, not == G.poll_exp - 4. 1910 /* NB: here kernel returns constant == G.poll_exp, not == G.poll_exp - 4.
1911 * Not sure why. Perhaps it is normal. 1911 * Not sure why. Perhaps it is normal.
1912 */ 1912 */
@@ -2248,7 +2248,7 @@ recv_and_process_client_pkt(void /*int fd*/)
2248 if (size < 0) { 2248 if (size < 0) {
2249 if (errno == EAGAIN) 2249 if (errno == EAGAIN)
2250 goto bail; 2250 goto bail;
2251 bb_perror_msg_and_die("recv"); 2251 bb_simple_perror_msg_and_die("recv");
2252 } 2252 }
2253 addr = xmalloc_sockaddr2dotted_noport(from); 2253 addr = xmalloc_sockaddr2dotted_noport(from);
2254 bb_error_msg("malformed packet received from %s: size %u", addr, (int)size); 2254 bb_error_msg("malformed packet received from %s: size %u", addr, (int)size);
@@ -2415,7 +2415,7 @@ static NOINLINE void ntp_init(char **argv)
2415 srand(getpid()); 2415 srand(getpid());
2416 2416
2417 if (getuid()) 2417 if (getuid())
2418 bb_error_msg_and_die(bb_msg_you_must_be_root); 2418 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
2419 2419
2420 /* Set some globals */ 2420 /* Set some globals */
2421 G.discipline_jitter = G_precision_sec; 2421 G.discipline_jitter = G_precision_sec;
@@ -2491,7 +2491,7 @@ static NOINLINE void ntp_init(char **argv)
2491 /* supports 'sha' and 'sha1' formats */ 2491 /* supports 'sha' and 'sha1' formats */
2492 hash_type = HASH_SHA1; 2492 hash_type = HASH_SHA1;
2493 else 2493 else
2494 bb_error_msg_and_die("only MD5 and SHA1 keys supported"); 2494 bb_simple_error_msg_and_die("only MD5 and SHA1 keys supported");
2495/* man ntp.keys: 2495/* man ntp.keys:
2496 * MD5 The key is 1 to 16 printable characters terminated by an EOL, 2496 * MD5 The key is 1 to 16 printable characters terminated by an EOL,
2497 * whitespace, or a # (which is the "start of comment" character). 2497 * whitespace, or a # (which is the "start of comment" character).
@@ -2674,7 +2674,7 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
2674 if (p->p_fd == -1) { 2674 if (p->p_fd == -1) {
2675 /* Time to send new req */ 2675 /* Time to send new req */
2676 if (--cnt == 0) { 2676 if (--cnt == 0) {
2677 VERB4 bb_error_msg("disabling burst mode"); 2677 VERB4 bb_simple_error_msg("disabling burst mode");
2678 G.polladj_count = 0; 2678 G.polladj_count = 0;
2679 G.poll_exp = MINPOLL; 2679 G.poll_exp = MINPOLL;
2680 } 2680 }
diff --git a/networking/ping.c b/networking/ping.c
index b534c74c7..a47342fee 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -184,8 +184,8 @@ create_icmp_socket(void)
184 sock = socket(AF_INET, SOCK_RAW, 1); /* 1 == ICMP */ 184 sock = socket(AF_INET, SOCK_RAW, 1); /* 1 == ICMP */
185 if (sock < 0) { 185 if (sock < 0) {
186 if (errno == EPERM) 186 if (errno == EPERM)
187 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 187 bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
188 bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); 188 bb_simple_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
189 } 189 }
190 190
191 xmove_fd(sock, pingsock); 191 xmove_fd(sock, pingsock);
@@ -235,7 +235,7 @@ static void ping4(len_and_sockaddr *lsa)
235#endif 235#endif
236 if (c < 0) { 236 if (c < 0) {
237 if (errno != EINTR) 237 if (errno != EINTR)
238 bb_perror_msg("recvfrom"); 238 bb_simple_perror_msg("recvfrom");
239 continue; 239 continue;
240 } 240 }
241 if (c >= 76) { /* ip + icmp */ 241 if (c >= 76) { /* ip + icmp */
@@ -280,7 +280,7 @@ static void ping6(len_and_sockaddr *lsa)
280#endif 280#endif
281 if (c < 0) { 281 if (c < 0) {
282 if (errno != EINTR) 282 if (errno != EINTR)
283 bb_perror_msg("recvfrom"); 283 bb_simple_perror_msg("recvfrom");
284 continue; 284 continue;
285 } 285 }
286 if (c >= ICMP_MINLEN) { /* icmp6_hdr */ 286 if (c >= ICMP_MINLEN) { /* icmp6_hdr */
@@ -482,7 +482,7 @@ static void sendping_tail(void (*sp)(int), int size_pkt)
482 * it doesn't matter */ 482 * it doesn't matter */
483 sz = xsendto(pingsock, G.snd_packet, size_pkt, &pingaddr.sa, sizeof(pingaddr)); 483 sz = xsendto(pingsock, G.snd_packet, size_pkt, &pingaddr.sa, sizeof(pingaddr));
484 if (sz != size_pkt) 484 if (sz != size_pkt)
485 bb_error_msg_and_die(bb_msg_write_error); 485 bb_simple_error_msg_and_die(bb_msg_write_error);
486 486
487 if (pingcount == 0 || G.ntransmitted < pingcount) { 487 if (pingcount == 0 || G.ntransmitted < pingcount) {
488 /* Didn't send all pings yet - schedule next in -i SEC interval */ 488 /* Didn't send all pings yet - schedule next in -i SEC interval */
@@ -723,7 +723,7 @@ static void ping4(len_and_sockaddr *lsa)
723 if (source_lsa) { 723 if (source_lsa) {
724 if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF, 724 if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF,
725 &source_lsa->u.sa, source_lsa->len)) 725 &source_lsa->u.sa, source_lsa->len))
726 bb_error_msg_and_die("can't set multicast source interface"); 726 bb_simple_error_msg_and_die("can't set multicast source interface");
727 xbind(pingsock, &source_lsa->u.sa, source_lsa->len); 727 xbind(pingsock, &source_lsa->u.sa, source_lsa->len);
728 } 728 }
729 729
@@ -757,7 +757,7 @@ static void ping4(len_and_sockaddr *lsa)
757 (struct sockaddr *) &from, &fromlen); 757 (struct sockaddr *) &from, &fromlen);
758 if (c < 0) { 758 if (c < 0) {
759 if (errno != EINTR) 759 if (errno != EINTR)
760 bb_perror_msg("recvfrom"); 760 bb_simple_perror_msg("recvfrom");
761 continue; 761 continue;
762 } 762 }
763 c = unpack4(G.rcv_packet, c, &from); 763 c = unpack4(G.rcv_packet, c, &from);
@@ -838,7 +838,7 @@ static void ping6(len_and_sockaddr *lsa)
838 c = recvmsg(pingsock, &msg, 0); 838 c = recvmsg(pingsock, &msg, 0);
839 if (c < 0) { 839 if (c < 0) {
840 if (errno != EINTR) 840 if (errno != EINTR)
841 bb_perror_msg("recvfrom"); 841 bb_simple_perror_msg("recvfrom");
842 continue; 842 continue;
843 } 843 }
844 for (mp = CMSG_FIRSTHDR(&msg); mp; mp = CMSG_NXTHDR(&msg, mp)) { 844 for (mp = CMSG_FIRSTHDR(&msg); mp; mp = CMSG_NXTHDR(&msg, mp)) {
diff --git a/networking/route.c b/networking/route.c
index ac1d94c28..a5d8d7cb9 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -336,7 +336,7 @@ static NOINLINE void INET_setroute(int action, char **args)
336 } 336 }
337 mask = ((struct sockaddr_in *) &rt->rt_dst)->sin_addr.s_addr; 337 mask = ((struct sockaddr_in *) &rt->rt_dst)->sin_addr.s_addr;
338 if (mask & ~(uint32_t)mask_in_addr(*rt)) { 338 if (mask & ~(uint32_t)mask_in_addr(*rt)) {
339 bb_error_msg_and_die("netmask and route address conflict"); 339 bb_simple_error_msg_and_die("netmask and route address conflict");
340 } 340 }
341 } 341 }
342 342
@@ -532,7 +532,7 @@ void FAST_FUNC bb_displayroutes(int noresolve, int netstatfmt)
532 if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */ 532 if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */
533 break; 533 break;
534 } 534 }
535 bb_perror_msg_and_die(bb_msg_read_error); 535 bb_simple_perror_msg_and_die(bb_msg_read_error);
536 } 536 }
537 537
538 if (!(flgs & RTF_UP)) { /* Skip interfaces that are down. */ 538 if (!(flgs & RTF_UP)) { /* Skip interfaces that are down. */
@@ -598,7 +598,7 @@ static void INET6_displayroutes(void)
598 break; 598 break;
599 } 599 }
600 ERROR: 600 ERROR:
601 bb_perror_msg_and_die(bb_msg_read_error); 601 bb_simple_perror_msg_and_die(bb_msg_read_error);
602 } 602 }
603 603
604 /* Do the addr6x shift-and-insert changes to ':'-delimit addresses. 604 /* Do the addr6x shift-and-insert changes to ':'-delimit addresses.
diff --git a/networking/slattach.c b/networking/slattach.c
index c6feca248..659822a91 100644
--- a/networking/slattach.c
+++ b/networking/slattach.c
@@ -56,7 +56,7 @@ static int tcsetattr_serial_or_warn(struct termios *state)
56 56
57 ret = tcsetattr(serial_fd, TCSANOW, state); 57 ret = tcsetattr(serial_fd, TCSANOW, state);
58 if (ret != 0) { 58 if (ret != 0) {
59 bb_perror_msg("tcsetattr"); 59 bb_simple_perror_msg("tcsetattr");
60 return 1; /* used as exitcode */ 60 return 1; /* used as exitcode */
61 } 61 }
62 return ret; /* 0 */ 62 return ret; /* 0 */
@@ -159,7 +159,7 @@ int slattach_main(int argc UNUSED_PARAM, char **argv)
159 159
160 /* Save current tty state */ 160 /* Save current tty state */
161 if (tcgetattr(serial_fd, &G.saved_state) != 0) 161 if (tcgetattr(serial_fd, &G.saved_state) != 0)
162 bb_perror_msg_and_die("tcgetattr"); 162 bb_simple_perror_msg_and_die("tcgetattr");
163 /* Save line discipline */ 163 /* Save line discipline */
164 xioctl(serial_fd, TIOCGETD, &G.saved_disc); 164 xioctl(serial_fd, TIOCGETD, &G.saved_disc);
165 165
diff --git a/networking/tcpudp.c b/networking/tcpudp.c
index a0af64981..8c4afabf6 100644
--- a/networking/tcpudp.c
+++ b/networking/tcpudp.c
@@ -325,7 +325,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
325 client = 0; 325 client = 0;
326 if ((getuid() == 0) && !(opts & OPT_u)) { 326 if ((getuid() == 0) && !(opts & OPT_u)) {
327 xfunc_error_retval = 100; 327 xfunc_error_retval = 100;
328 bb_error_msg_and_die(bb_msg_you_must_be_root); 328 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
329 } 329 }
330 if (opts & OPT_u) 330 if (opts & OPT_u)
331 if (!uidgid_get(&sslugid, ssluser, 1)) { 331 if (!uidgid_get(&sslugid, ssluser, 1)) {
@@ -419,7 +419,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
419 sig_block(SIGCHLD); 419 sig_block(SIGCHLD);
420 if (conn < 0) { 420 if (conn < 0) {
421 if (errno != EINTR) 421 if (errno != EINTR)
422 bb_perror_msg(tcp ? "accept" : "recv"); 422 bb_simple_perror_msg(tcp ? "accept" : "recv");
423 goto again2; 423 goto again2;
424 } 424 }
425 xmove_fd(tcp ? conn : sock, 0); 425 xmove_fd(tcp ? conn : sock, 0);
@@ -484,7 +484,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
484 484
485 pid = vfork(); 485 pid = vfork();
486 if (pid == -1) { 486 if (pid == -1) {
487 bb_perror_msg("vfork"); 487 bb_simple_perror_msg("vfork");
488 goto again; 488 goto again;
489 } 489 }
490 490
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 6abecbde2..29f805de7 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -495,7 +495,7 @@ make_new_session(
495 free(ts); 495 free(ts);
496 close(fd); 496 close(fd);
497 /* sock will be closed by caller */ 497 /* sock will be closed by caller */
498 bb_perror_msg("vfork"); 498 bb_simple_perror_msg("vfork");
499 return NULL; 499 return NULL;
500 } 500 }
501 if (pid > 0) { 501 if (pid > 0) {
diff --git a/networking/tftp.c b/networking/tftp.c
index d551c861f..04bfe844f 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -453,7 +453,7 @@ static int tftp_protocol(
453 /* fill in packet if the filename fits into xbuf */ 453 /* fill in packet if the filename fits into xbuf */
454 len = strlen(remote_file) + 1; 454 len = strlen(remote_file) + 1;
455 if (2 + len + sizeof("octet") >= io_bufsize) { 455 if (2 + len + sizeof("octet") >= io_bufsize) {
456 bb_error_msg("remote filename is too long"); 456 bb_simple_error_msg("remote filename is too long");
457 goto ret; 457 goto ret;
458 } 458 }
459 strcpy(cp, remote_file); 459 strcpy(cp, remote_file);
@@ -468,7 +468,7 @@ static int tftp_protocol(
468 468
469 /* Need to add option to pkt */ 469 /* Need to add option to pkt */
470 if ((&xbuf[io_bufsize - 1] - cp) < sizeof("blksize NNNNN tsize ") + sizeof(off_t)*3) { 470 if ((&xbuf[io_bufsize - 1] - cp) < sizeof("blksize NNNNN tsize ") + sizeof(off_t)*3) {
471 bb_error_msg("remote filename is too long"); 471 bb_simple_error_msg("remote filename is too long");
472 goto ret; 472 goto ret;
473 } 473 }
474 expect_OACK = 1; 474 expect_OACK = 1;
@@ -569,7 +569,7 @@ static int tftp_protocol(
569 retries--; 569 retries--;
570 if (retries == 0) { 570 if (retries == 0) {
571 tftp_progress_done(); 571 tftp_progress_done();
572 bb_error_msg("timeout"); 572 bb_simple_error_msg("timeout");
573 goto ret; /* no err packet sent */ 573 goto ret; /* no err packet sent */
574 } 574 }
575 575
@@ -674,7 +674,7 @@ static int tftp_protocol(
674 * must be ignored by the client and server 674 * must be ignored by the client and server
675 * as if it were never requested." */ 675 * as if it were never requested." */
676 if (blksize != TFTP_BLKSIZE_DEFAULT) 676 if (blksize != TFTP_BLKSIZE_DEFAULT)
677 bb_error_msg("falling back to blocksize "TFTP_BLKSIZE_DEFAULT_STR); 677 bb_simple_error_msg("falling back to blocksize "TFTP_BLKSIZE_DEFAULT_STR);
678 blksize = TFTP_BLKSIZE_DEFAULT; 678 blksize = TFTP_BLKSIZE_DEFAULT;
679 io_bufsize = TFTP_BLKSIZE_DEFAULT + 4; 679 io_bufsize = TFTP_BLKSIZE_DEFAULT + 4;
680 } 680 }
@@ -739,7 +739,7 @@ static int tftp_protocol(
739 strcpy(G_error_pkt_str, bb_msg_read_error); 739 strcpy(G_error_pkt_str, bb_msg_read_error);
740 send_err_pkt: 740 send_err_pkt:
741 if (G_error_pkt_str[0]) 741 if (G_error_pkt_str[0])
742 bb_error_msg("%s", G_error_pkt_str); 742 bb_simple_error_msg(G_error_pkt_str);
743 G.error_pkt[1] = TFTP_ERROR; 743 G.error_pkt[1] = TFTP_ERROR;
744 xsendto(socket_fd, G.error_pkt, 4 + 1 + strlen(G_error_pkt_str), 744 xsendto(socket_fd, G.error_pkt, 4 + 1 + strlen(G_error_pkt_str),
745 &peer_lsa->u.sa, peer_lsa->len); 745 &peer_lsa->u.sa, peer_lsa->len);
diff --git a/networking/tls.c b/networking/tls.c
index db7be07f3..854937302 100644
--- a/networking/tls.c
+++ b/networking/tls.c
@@ -446,7 +446,7 @@ static void hmac_begin(hmac_precomputed_t *pre, uint8_t *key, unsigned key_size,
446 // than INSIZE bytes will first hash the key using H and then use the 446 // than INSIZE bytes will first hash the key using H and then use the
447 // resultant OUTSIZE byte string as the actual key to HMAC." 447 // resultant OUTSIZE byte string as the actual key to HMAC."
448 if (key_size > SHA_INSIZE) { 448 if (key_size > SHA_INSIZE) {
449 bb_error_msg_and_die("HMAC key>64"); //does not happen (yet?) 449 bb_simple_error_msg_and_die("HMAC key>64"); //does not happen (yet?)
450// md5sha_ctx_t ctx; 450// md5sha_ctx_t ctx;
451// begin(&ctx); 451// begin(&ctx);
452// md5sha_hash(&ctx, key, key_size); 452// md5sha_hash(&ctx, key, key_size);
@@ -1132,7 +1132,7 @@ static int tls_xread_record(tls_state_t *tls, const char *expected)
1132 } 1132 }
1133 } 1133 }
1134 if (sz < 0) 1134 if (sz < 0)
1135 bb_error_msg_and_die("encrypted data too short"); 1135 bb_simple_error_msg_and_die("encrypted data too short");
1136 1136
1137 //dump_hex("<< %s\n", tls->inbuf, RECHDR_LEN + sz); 1137 //dump_hex("<< %s\n", tls->inbuf, RECHDR_LEN + sz);
1138 1138
@@ -1411,7 +1411,7 @@ static void find_key_in_der_cert(tls_state_t *tls, uint8_t *der, int len)
1411 dbg("ECDSA key\n"); 1411 dbg("ECDSA key\n");
1412 //UNUSED: tls->flags |= GOT_CERT_ECDSA_KEY_ALG; 1412 //UNUSED: tls->flags |= GOT_CERT_ECDSA_KEY_ALG;
1413 } else 1413 } else
1414 bb_error_msg_and_die("not RSA or ECDSA cert"); 1414 bb_simple_error_msg_and_die("not RSA or ECDSA cert");
1415 } 1415 }
1416 1416
1417 if (tls->flags & GOT_CERT_RSA_KEY_ALG) { 1417 if (tls->flags & GOT_CERT_RSA_KEY_ALG) {
@@ -1882,7 +1882,7 @@ static void process_server_key(tls_state_t *tls, int len)
1882 /* So far we only support curve_x25519 */ 1882 /* So far we only support curve_x25519 */
1883 move_from_unaligned32(t32, keybuf); 1883 move_from_unaligned32(t32, keybuf);
1884 if (t32 != htonl(0x03001d20)) 1884 if (t32 != htonl(0x03001d20))
1885 bb_error_msg_and_die("elliptic curve is not x25519"); 1885 bb_simple_error_msg_and_die("elliptic curve is not x25519");
1886 1886
1887 memcpy(tls->hsd->ecc_pub_key32, keybuf + 4, 32); 1887 memcpy(tls->hsd->ecc_pub_key32, keybuf + 4, 32);
1888 tls->flags |= GOT_EC_KEY; 1888 tls->flags |= GOT_EC_KEY;
@@ -1929,7 +1929,7 @@ static void send_client_key_exchange(tls_state_t *tls)
1929 if (!(tls->flags & NEED_EC_KEY)) { 1929 if (!(tls->flags & NEED_EC_KEY)) {
1930 /* RSA */ 1930 /* RSA */
1931 if (!(tls->flags & GOT_CERT_RSA_KEY_ALG)) 1931 if (!(tls->flags & GOT_CERT_RSA_KEY_ALG))
1932 bb_error_msg("server cert is not RSA"); 1932 bb_simple_error_msg("server cert is not RSA");
1933 1933
1934 tls_get_random(rsa_premaster, sizeof(rsa_premaster)); 1934 tls_get_random(rsa_premaster, sizeof(rsa_premaster));
1935 if (TLS_DEBUG_FIXED_SECRETS) 1935 if (TLS_DEBUG_FIXED_SECRETS)
@@ -1959,7 +1959,7 @@ static void send_client_key_exchange(tls_state_t *tls)
1959 uint8_t privkey[CURVE25519_KEYSIZE]; //[32] 1959 uint8_t privkey[CURVE25519_KEYSIZE]; //[32]
1960 1960
1961 if (!(tls->flags & GOT_EC_KEY)) 1961 if (!(tls->flags & GOT_EC_KEY))
1962 bb_error_msg("server did not provide EC key"); 1962 bb_simple_error_msg("server did not provide EC key");
1963 1963
1964 /* Generate random private key, see RFC 7748 */ 1964 /* Generate random private key, see RFC 7748 */
1965 tls_get_random(privkey, sizeof(privkey)); 1965 tls_get_random(privkey, sizeof(privkey));
@@ -2322,7 +2322,7 @@ void FAST_FUNC tls_run_copy_loop(tls_state_t *tls, unsigned flags)
2322 int nread; 2322 int nread;
2323 2323
2324 if (safe_poll(pfds, 2, -1) < 0) 2324 if (safe_poll(pfds, 2, -1) < 0)
2325 bb_perror_msg_and_die("poll"); 2325 bb_simple_perror_msg_and_die("poll");
2326 2326
2327 if (pfds[0].revents) { 2327 if (pfds[0].revents) {
2328 void *buf; 2328 void *buf;
diff --git a/networking/tls.h b/networking/tls.h
index 494ed78c4..d4ac1bef8 100644
--- a/networking/tls.h
+++ b/networking/tls.h
@@ -90,7 +90,7 @@ void xorbuf_aligned_AES_BLOCK_SIZE(void* buf, const void* mask) FAST_FUNC;
90#define matrixCryptoGetPrngData(buf, len, userPtr) (tls_get_random(buf, len), PS_SUCCESS) 90#define matrixCryptoGetPrngData(buf, len, userPtr) (tls_get_random(buf, len), PS_SUCCESS)
91 91
92#define psFree(p, pool) free(p) 92#define psFree(p, pool) free(p)
93#define psTraceCrypto(...) bb_error_msg_and_die(__VA_ARGS__) 93#define psTraceCrypto(msg) bb_simple_error_msg_and_die(msg)
94 94
95/* Secure zerofill */ 95/* Secure zerofill */
96#define memset_s(A,B,C,D) memset((A),(C),(D)) 96#define memset_s(A,B,C,D) memset((A),(C),(D))
diff --git a/networking/traceroute.c b/networking/traceroute.c
index bdf451186..0435d6ba6 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -875,7 +875,7 @@ common_traceroute_main(int op, char **argv)
875 * probe (e.g., on a multi-homed host). 875 * probe (e.g., on a multi-homed host).
876 */ 876 */
877 if (getuid() != 0) 877 if (getuid() != 0)
878 bb_error_msg_and_die(bb_msg_you_must_be_root); 878 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
879 } 879 }
880 if (op & OPT_WAITTIME) 880 if (op & OPT_WAITTIME)
881 waittime = xatou_range(waittime_str, 1, 24 * 60 * 60); 881 waittime = xatou_range(waittime_str, 1, 24 * 60 * 60);
@@ -1003,7 +1003,7 @@ common_traceroute_main(int op, char **argv)
1003 if (af == AF_INET) 1003 if (af == AF_INET)
1004 if (setsockopt(sndsock, IPPROTO_IP, IP_MULTICAST_IF, 1004 if (setsockopt(sndsock, IPPROTO_IP, IP_MULTICAST_IF,
1005 &source_lsa->u.sa, source_lsa->len)) 1005 &source_lsa->u.sa, source_lsa->len))
1006 bb_error_msg_and_die("can't set multicast source interface"); 1006 bb_simple_error_msg_and_die("can't set multicast source interface");
1007//TODO: we can query source port we bound to, 1007//TODO: we can query source port we bound to,
1008// and check it in replies... if we care enough 1008// and check it in replies... if we care enough
1009 xbind(sndsock, &source_lsa->u.sa, source_lsa->len); 1009 xbind(sndsock, &source_lsa->u.sa, source_lsa->len);
@@ -1025,7 +1025,7 @@ common_traceroute_main(int op, char **argv)
1025 /* read IP and port */ 1025 /* read IP and port */
1026 source_lsa = get_sock_lsa(probe_fd); 1026 source_lsa = get_sock_lsa(probe_fd);
1027 if (source_lsa == NULL) 1027 if (source_lsa == NULL)
1028 bb_error_msg_and_die("can't get probe addr"); 1028 bb_simple_error_msg_and_die("can't get probe addr");
1029 1029
1030 close(probe_fd); 1030 close(probe_fd);
1031 1031
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index 215d023ce..a395e838d 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -53,12 +53,12 @@ int FAST_FUNC arpping(uint32_t test_nip,
53 53
54 s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP)); 54 s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP));
55 if (s == -1) { 55 if (s == -1) {
56 bb_perror_msg(bb_msg_can_not_create_raw_socket); 56 bb_simple_perror_msg(bb_msg_can_not_create_raw_socket);
57 return -1; 57 return -1;
58 } 58 }
59 59
60 if (setsockopt_broadcast(s) == -1) { 60 if (setsockopt_broadcast(s) == -1) {
61 bb_perror_msg("can't enable bcast on raw socket"); 61 bb_simple_perror_msg("can't enable bcast on raw socket");
62 goto ret; 62 goto ret;
63 } 63 }
64 64
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 62ad248ce..4a452cdb9 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -240,7 +240,7 @@ uint8_t* FAST_FUNC udhcp_get_option(struct dhcp_packet *packet, int code)
240 while (1) { 240 while (1) {
241 if (rem <= 0) { 241 if (rem <= 0) {
242 complain: 242 complain:
243 bb_error_msg("bad packet, malformed option field"); 243 bb_simple_error_msg("bad packet, malformed option field");
244 return NULL; 244 return NULL;
245 } 245 }
246 246
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index bba3d6037..60255eefa 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -267,26 +267,45 @@ struct option_set *udhcp_find_option(struct option_set *opt_list, uint8_t code)
267# define IF_UDHCP_VERBOSE(...) __VA_ARGS__ 267# define IF_UDHCP_VERBOSE(...) __VA_ARGS__
268extern unsigned dhcp_verbose; 268extern unsigned dhcp_verbose;
269# define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0) 269# define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0)
270# define log1s(msg) do { if (dhcp_verbose >= 1) bb_simple_info_msg(msg); } while (0)
270# if CONFIG_UDHCP_DEBUG >= 2 271# if CONFIG_UDHCP_DEBUG >= 2
271void udhcp_dump_packet(struct dhcp_packet *packet) FAST_FUNC; 272void udhcp_dump_packet(struct dhcp_packet *packet) FAST_FUNC;
272# define log2(...) do { if (dhcp_verbose >= 2) bb_info_msg(__VA_ARGS__); } while (0) 273# define log2(...) do { if (dhcp_verbose >= 2) bb_info_msg(__VA_ARGS__); } while (0)
274# define log2s(msg) do { if (dhcp_verbose >= 2) bb_simple_info_msg(msg); } while (0)
273# else 275# else
274# define udhcp_dump_packet(...) ((void)0) 276# define udhcp_dump_packet(...) ((void)0)
275# define log2(...) ((void)0) 277# define log2(...) ((void)0)
278# define log2s(msg) ((void)0)
276# endif 279# endif
277# if CONFIG_UDHCP_DEBUG >= 3 280# if CONFIG_UDHCP_DEBUG >= 3
278# define log3(...) do { if (dhcp_verbose >= 3) bb_info_msg(__VA_ARGS__); } while (0) 281# define log3(...) do { if (dhcp_verbose >= 3) bb_info_msg(__VA_ARGS__); } while (0)
282# define log3s(msg) do { if (dhcp_verbose >= 3) bb_simple_info_msg(msg); } while (0)
279# else 283# else
280# define log3(...) ((void)0) 284# define log3(...) ((void)0)
285# define log3s(msg) ((void)0)
281# endif 286# endif
282#else 287#else
283# define IF_UDHCP_VERBOSE(...) 288# define IF_UDHCP_VERBOSE(...)
284# define udhcp_dump_packet(...) ((void)0) 289# define udhcp_dump_packet(...) ((void)0)
285# define log1(...) ((void)0) 290# define log1(...) ((void)0)
291# define log1s(msg) ((void)0)
286# define log2(...) ((void)0) 292# define log2(...) ((void)0)
293# define log2s(msg) ((void)0)
287# define log3(...) ((void)0) 294# define log3(...) ((void)0)
295# define log3s(msg) ((void)0)
288#endif 296#endif
289 297
298#if defined(__mips__)
299/*
300 * The 'simple' message functions have a negative impact on the size of the
301 * DHCP code when compiled for MIPS, so don't use them in this case.
302 */
303#define bb_simple_info_msg bb_info_msg
304#define bb_simple_error_msg bb_error_msg
305#define bb_simple_perror_msg_and_die bb_perror_msg_and_die
306#undef log1s
307#define log1s log1
308#endif
290 309
291/*** Other shared functions ***/ 310/*** Other shared functions ***/
292 311
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 4eb7ae1c1..9d8e17c51 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -235,7 +235,7 @@ static char *string_option_to_env(const uint8_t *option,
235 found: 235 found:
236 val_len = (option[2] << 8) | option[3]; 236 val_len = (option[2] << 8) | option[3];
237 if (val_len + &option[D6_OPT_DATA] > option_end) { 237 if (val_len + &option[D6_OPT_DATA] > option_end) {
238 bb_error_msg("option data exceeds option length"); 238 bb_simple_error_msg("option data exceeds option length");
239 return NULL; 239 return NULL;
240 } 240 }
241 return xasprintf("%s=%.*s", name, val_len, (char*)option + 4); 241 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
848 848
849 bytes = safe_read(fd, &packet, sizeof(packet)); 849 bytes = safe_read(fd, &packet, sizeof(packet));
850 if (bytes < 0) { 850 if (bytes < 0) {
851 log1("packet read error, ignoring"); 851 log1s("packet read error, ignoring");
852 /* NB: possible down interface, etc. Caller should pause. */ 852 /* NB: possible down interface, etc. Caller should pause. */
853 return bytes; /* returns -1 */ 853 return bytes; /* returns -1 */
854 } 854 }
855 855
856 if (bytes < (int) (sizeof(packet.ip6) + sizeof(packet.udp))) { 856 if (bytes < (int) (sizeof(packet.ip6) + sizeof(packet.udp))) {
857 log1("packet is too short, ignoring"); 857 log1s("packet is too short, ignoring");
858 return -2; 858 return -2;
859 } 859 }
860 860
861 if (bytes < sizeof(packet.ip6) + ntohs(packet.ip6.ip6_plen)) { 861 if (bytes < sizeof(packet.ip6) + ntohs(packet.ip6.ip6_plen)) {
862 /* packet is bigger than sizeof(packet), we did partial read */ 862 /* packet is bigger than sizeof(packet), we did partial read */
863 log1("oversized packet, ignoring"); 863 log1s("oversized packet, ignoring");
864 return -2; 864 return -2;
865 } 865 }
866 866
@@ -874,7 +874,7 @@ static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6, struct d6_pac
874 /* || bytes > (int) sizeof(packet) - can't happen */ 874 /* || bytes > (int) sizeof(packet) - can't happen */
875 || packet.udp.len != packet.ip6.ip6_plen 875 || packet.udp.len != packet.ip6.ip6_plen
876 ) { 876 ) {
877 log1("unrelated/bogus packet, ignoring"); 877 log1s("unrelated/bogus packet, ignoring");
878 return -2; 878 return -2;
879 } 879 }
880 880
@@ -1003,7 +1003,7 @@ static int d6_raw_socket(int ifindex)
1003 } 1003 }
1004#endif 1004#endif
1005 1005
1006 log1("created raw socket"); 1006 log1s("created raw socket");
1007 1007
1008 return fd; 1008 return fd;
1009} 1009}
@@ -1031,7 +1031,7 @@ static void change_listen_mode(int new_mode)
1031/* Called only on SIGUSR1 */ 1031/* Called only on SIGUSR1 */
1032static void perform_renew(void) 1032static void perform_renew(void)
1033{ 1033{
1034 bb_info_msg("performing DHCP renew"); 1034 bb_simple_info_msg("performing DHCP renew");
1035 switch (client_data.state) { 1035 switch (client_data.state) {
1036 case BOUND: 1036 case BOUND:
1037 change_listen_mode(LISTEN_KERNEL); 1037 change_listen_mode(LISTEN_KERNEL);
@@ -1059,10 +1059,10 @@ static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *ou
1059 || client_data.state == REBINDING 1059 || client_data.state == REBINDING
1060 || client_data.state == RENEW_REQUESTED 1060 || client_data.state == RENEW_REQUESTED
1061 ) { 1061 ) {
1062 bb_info_msg("unicasting a release"); 1062 bb_simple_info_msg("unicasting a release");
1063 send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */ 1063 send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */
1064 } 1064 }
1065 bb_info_msg("entering released state"); 1065 bb_simple_info_msg("entering released state");
1066/* 1066/*
1067 * We can be here on: SIGUSR2, 1067 * We can be here on: SIGUSR2,
1068 * or on exit (SIGTERM) and -R "release on quit" is specified. 1068 * or on exit (SIGTERM) and -R "release on quit" is specified.
@@ -1275,7 +1275,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1275 /* Create pidfile */ 1275 /* Create pidfile */
1276 write_pidfile(client_data.pidfile); 1276 write_pidfile(client_data.pidfile);
1277 /* Goes to stdout (unless NOMMU) and possibly syslog */ 1277 /* Goes to stdout (unless NOMMU) and possibly syslog */
1278 bb_info_msg("started, v"BB_VER); 1278 bb_simple_info_msg("started, v"BB_VER);
1279 1279
1280 client_data.state = INIT_SELECTING; 1280 client_data.state = INIT_SELECTING;
1281 d6_run_script_no_option("deconfig"); 1281 d6_run_script_no_option("deconfig");
@@ -1321,7 +1321,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1321 continue; 1321 continue;
1322 } 1322 }
1323 /* Else: an error occured, panic! */ 1323 /* Else: an error occured, panic! */
1324 bb_perror_msg_and_die("poll"); 1324 bb_simple_perror_msg_and_die("poll");
1325 } 1325 }
1326 } 1326 }
1327 1327
@@ -1362,7 +1362,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1362 d6_run_script_no_option("leasefail"); 1362 d6_run_script_no_option("leasefail");
1363#if BB_MMU /* -b is not supported on NOMMU */ 1363#if BB_MMU /* -b is not supported on NOMMU */
1364 if (opt & OPT_b) { /* background if no lease */ 1364 if (opt & OPT_b) { /* background if no lease */
1365 bb_info_msg("no lease, forking to background"); 1365 bb_simple_info_msg("no lease, forking to background");
1366 client_background(); 1366 client_background();
1367 /* do not background again! */ 1367 /* do not background again! */
1368 opt = ((opt & ~(OPT_b|OPT_n)) | OPT_f); 1368 opt = ((opt & ~(OPT_b|OPT_n)) | OPT_f);
@@ -1375,7 +1375,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1375 } else 1375 } else
1376#endif 1376#endif
1377 if (opt & OPT_n) { /* abort if no lease */ 1377 if (opt & OPT_n) { /* abort if no lease */
1378 bb_info_msg("no lease, failing"); 1378 bb_simple_info_msg("no lease, failing");
1379 retval = 1; 1379 retval = 1;
1380 goto ret; 1380 goto ret;
1381 } 1381 }
@@ -1403,7 +1403,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1403 client_data.state = RENEWING; 1403 client_data.state = RENEWING;
1404 client_data.first_secs = 0; /* make secs field count from 0 */ 1404 client_data.first_secs = 0; /* make secs field count from 0 */
1405 change_listen_mode(LISTEN_KERNEL); 1405 change_listen_mode(LISTEN_KERNEL);
1406 log1("entering renew state"); 1406 log1s("entering renew state");
1407 /* fall right through */ 1407 /* fall right through */
1408 case RENEW_REQUESTED: /* manual (SIGUSR1) renew */ 1408 case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
1409 case_RENEW_REQUESTED: 1409 case_RENEW_REQUESTED:
@@ -1423,7 +1423,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1423 continue; 1423 continue;
1424 } 1424 }
1425 /* Timed out, enter rebinding state */ 1425 /* Timed out, enter rebinding state */
1426 log1("entering rebinding state"); 1426 log1s("entering rebinding state");
1427 client_data.state = REBINDING; 1427 client_data.state = REBINDING;
1428 /* fall right through */ 1428 /* fall right through */
1429 case REBINDING: 1429 case REBINDING:
@@ -1438,7 +1438,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1438 continue; 1438 continue;
1439 } 1439 }
1440 /* Timed out, enter init state */ 1440 /* Timed out, enter init state */
1441 bb_info_msg("lease lost, entering init state"); 1441 bb_simple_info_msg("lease lost, entering init state");
1442 d6_run_script_no_option("deconfig"); 1442 d6_run_script_no_option("deconfig");
1443 client_data.state = INIT_SELECTING; 1443 client_data.state = INIT_SELECTING;
1444 client_data.first_secs = 0; /* make secs field count from 0 */ 1444 client_data.first_secs = 0; /* make secs field count from 0 */
@@ -1560,7 +1560,7 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv)
1560 } 1560 }
1561 option = d6_copy_option(packet.d6_options, packet_end, D6_OPT_SERVERID); 1561 option = d6_copy_option(packet.d6_options, packet_end, D6_OPT_SERVERID);
1562 if (!option) { 1562 if (!option) {
1563 bb_info_msg("no server ID, ignoring packet"); 1563 bb_simple_info_msg("no server ID, ignoring packet");
1564 continue; 1564 continue;
1565 /* still selecting - this server looks bad */ 1565 /* still selecting - this server looks bad */
1566 } 1566 }
diff --git a/networking/udhcp/d6_packet.c b/networking/udhcp/d6_packet.c
index 01d1c930b..446497e15 100644
--- a/networking/udhcp/d6_packet.c
+++ b/networking/udhcp/d6_packet.c
@@ -35,12 +35,12 @@ int FAST_FUNC d6_recv_kernel_packet(struct in6_addr *peer_ipv6
35 memset(packet, 0, sizeof(*packet)); 35 memset(packet, 0, sizeof(*packet));
36 bytes = safe_read(fd, packet, sizeof(*packet)); 36 bytes = safe_read(fd, packet, sizeof(*packet));
37 if (bytes < 0) { 37 if (bytes < 0) {
38 log1("packet read error, ignoring"); 38 log1s("packet read error, ignoring");
39 return bytes; /* returns -1 */ 39 return bytes; /* returns -1 */
40 } 40 }
41 41
42 if (bytes < offsetof(struct d6_packet, d6_options)) { 42 if (bytes < offsetof(struct d6_packet, d6_options)) {
43 bb_info_msg("packet with bad magic, ignoring"); 43 bb_simple_info_msg("packet with bad magic, ignoring");
44 return -2; 44 return -2;
45 } 45 }
46 log1("received %s", "a packet"); 46 log1("received %s", "a packet");
diff --git a/networking/udhcp/d6_socket.c b/networking/udhcp/d6_socket.c
index 25e622d6f..8ddee5a8e 100644
--- a/networking/udhcp/d6_socket.c
+++ b/networking/udhcp/d6_socket.c
@@ -115,7 +115,7 @@ int FAST_FUNC d6_listen_socket(int port, const char *inf)
115 115
116 setsockopt_reuseaddr(fd); 116 setsockopt_reuseaddr(fd);
117 if (setsockopt_broadcast(fd) == -1) 117 if (setsockopt_broadcast(fd) == -1)
118 bb_perror_msg_and_die("SO_BROADCAST"); 118 bb_simple_perror_msg_and_die("SO_BROADCAST");
119 119
120 /* NB: bug 1032 says this doesn't work on ethernet aliases (ethN:M) */ 120 /* NB: bug 1032 says this doesn't work on ethernet aliases (ethN:M) */
121 if (setsockopt_bindtodevice(fd, inf)) 121 if (setsockopt_bindtodevice(fd, inf))
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index d1a0eaf02..656295ff7 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -906,7 +906,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
906 if (bytes < 0) { 906 if (bytes < 0) {
907 if (errno == EINTR) 907 if (errno == EINTR)
908 continue; 908 continue;
909 log1("packet read error, ignoring"); 909 log1s("packet read error, ignoring");
910 /* NB: possible down interface, etc. Caller should pause. */ 910 /* NB: possible down interface, etc. Caller should pause. */
911 return bytes; /* returns -1 */ 911 return bytes; /* returns -1 */
912 } 912 }
@@ -914,13 +914,13 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
914 } 914 }
915 915
916 if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp))) { 916 if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp))) {
917 log1("packet is too short, ignoring"); 917 log1s("packet is too short, ignoring");
918 return -2; 918 return -2;
919 } 919 }
920 920
921 if (bytes < ntohs(packet.ip.tot_len)) { 921 if (bytes < ntohs(packet.ip.tot_len)) {
922 /* packet is bigger than sizeof(packet), we did partial read */ 922 /* packet is bigger than sizeof(packet), we did partial read */
923 log1("oversized packet, ignoring"); 923 log1s("oversized packet, ignoring");
924 return -2; 924 return -2;
925 } 925 }
926 926
@@ -935,7 +935,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
935 /* || bytes > (int) sizeof(packet) - can't happen */ 935 /* || bytes > (int) sizeof(packet) - can't happen */
936 || ntohs(packet.udp.len) != (uint16_t)(bytes - sizeof(packet.ip)) 936 || ntohs(packet.udp.len) != (uint16_t)(bytes - sizeof(packet.ip))
937 ) { 937 ) {
938 log1("unrelated/bogus packet, ignoring"); 938 log1s("unrelated/bogus packet, ignoring");
939 return -2; 939 return -2;
940 } 940 }
941 941
@@ -943,7 +943,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
943 check = packet.ip.check; 943 check = packet.ip.check;
944 packet.ip.check = 0; 944 packet.ip.check = 0;
945 if (check != inet_cksum((uint16_t *)&packet.ip, sizeof(packet.ip))) { 945 if (check != inet_cksum((uint16_t *)&packet.ip, sizeof(packet.ip))) {
946 log1("bad IP header checksum, ignoring"); 946 log1s("bad IP header checksum, ignoring");
947 return -2; 947 return -2;
948 } 948 }
949 949
@@ -968,13 +968,13 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
968 check = packet.udp.check; 968 check = packet.udp.check;
969 packet.udp.check = 0; 969 packet.udp.check = 0;
970 if (check && check != inet_cksum((uint16_t *)&packet, bytes)) { 970 if (check && check != inet_cksum((uint16_t *)&packet, bytes)) {
971 log1("packet with bad UDP checksum received, ignoring"); 971 log1s("packet with bad UDP checksum received, ignoring");
972 return -2; 972 return -2;
973 } 973 }
974 skip_udp_sum_check: 974 skip_udp_sum_check:
975 975
976 if (packet.data.cookie != htonl(DHCP_MAGIC)) { 976 if (packet.data.cookie != htonl(DHCP_MAGIC)) {
977 bb_info_msg("packet with bad magic, ignoring"); 977 bb_simple_info_msg("packet with bad magic, ignoring");
978 return -2; 978 return -2;
979 } 979 }
980 980
@@ -1089,10 +1089,10 @@ static int udhcp_raw_socket(int ifindex)
1089 1089
1090 if (setsockopt_1(fd, SOL_PACKET, PACKET_AUXDATA) != 0) { 1090 if (setsockopt_1(fd, SOL_PACKET, PACKET_AUXDATA) != 0) {
1091 if (errno != ENOPROTOOPT) 1091 if (errno != ENOPROTOOPT)
1092 log1("can't set PACKET_AUXDATA on raw socket"); 1092 log1s("can't set PACKET_AUXDATA on raw socket");
1093 } 1093 }
1094 1094
1095 log1("created raw socket"); 1095 log1s("created raw socket");
1096 1096
1097 return fd; 1097 return fd;
1098} 1098}
@@ -1120,7 +1120,7 @@ static void change_listen_mode(int new_mode)
1120/* Called only on SIGUSR1 */ 1120/* Called only on SIGUSR1 */
1121static void perform_renew(void) 1121static void perform_renew(void)
1122{ 1122{
1123 bb_info_msg("performing DHCP renew"); 1123 bb_simple_info_msg("performing DHCP renew");
1124 switch (client_data.state) { 1124 switch (client_data.state) {
1125 case BOUND: 1125 case BOUND:
1126 change_listen_mode(LISTEN_KERNEL); 1126 change_listen_mode(LISTEN_KERNEL);
@@ -1158,7 +1158,7 @@ static void perform_release(uint32_t server_addr, uint32_t requested_ip)
1158 inet_ntoa(temp_addr), buffer); 1158 inet_ntoa(temp_addr), buffer);
1159 send_release(server_addr, requested_ip); /* unicast */ 1159 send_release(server_addr, requested_ip); /* unicast */
1160 } 1160 }
1161 bb_info_msg("entering released state"); 1161 bb_simple_info_msg("entering released state");
1162/* 1162/*
1163 * We can be here on: SIGUSR2, 1163 * We can be here on: SIGUSR2,
1164 * or on exit (SIGTERM) and -R "release on quit" is specified. 1164 * or on exit (SIGTERM) and -R "release on quit" is specified.
@@ -1303,7 +1303,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1303 ); 1303 );
1304 if (opt & (OPT_h|OPT_H)) { 1304 if (opt & (OPT_h|OPT_H)) {
1305 //msg added 2011-11 1305 //msg added 2011-11
1306 bb_error_msg("option -h NAME is deprecated, use -x hostname:NAME"); 1306 bb_simple_error_msg("option -h NAME is deprecated, use -x hostname:NAME");
1307 client_data.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0); 1307 client_data.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
1308 } 1308 }
1309 if (opt & OPT_F) { 1309 if (opt & OPT_F) {
@@ -1397,7 +1397,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1397 /* Create pidfile */ 1397 /* Create pidfile */
1398 write_pidfile(client_data.pidfile); 1398 write_pidfile(client_data.pidfile);
1399 /* Goes to stdout (unless NOMMU) and possibly syslog */ 1399 /* Goes to stdout (unless NOMMU) and possibly syslog */
1400 bb_info_msg("started, v"BB_VER); 1400 bb_simple_info_msg("started, v"BB_VER);
1401 /* We want random_xid to be random... */ 1401 /* We want random_xid to be random... */
1402 srand(monotonic_us()); 1402 srand(monotonic_us());
1403 1403
@@ -1444,7 +1444,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1444 continue; 1444 continue;
1445 } 1445 }
1446 /* Else: an error occurred, panic! */ 1446 /* Else: an error occurred, panic! */
1447 bb_perror_msg_and_die("poll"); 1447 bb_simple_perror_msg_and_die("poll");
1448 } 1448 }
1449 } 1449 }
1450 1450
@@ -1485,7 +1485,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1485 udhcp_run_script(NULL, "leasefail"); 1485 udhcp_run_script(NULL, "leasefail");
1486#if BB_MMU /* -b is not supported on NOMMU */ 1486#if BB_MMU /* -b is not supported on NOMMU */
1487 if (opt & OPT_b) { /* background if no lease */ 1487 if (opt & OPT_b) { /* background if no lease */
1488 bb_info_msg("no lease, forking to background"); 1488 bb_simple_info_msg("no lease, forking to background");
1489 client_background(); 1489 client_background();
1490 /* do not background again! */ 1490 /* do not background again! */
1491 opt = ((opt & ~(OPT_b|OPT_n)) | OPT_f); 1491 opt = ((opt & ~(OPT_b|OPT_n)) | OPT_f);
@@ -1498,7 +1498,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1498 } else 1498 } else
1499#endif 1499#endif
1500 if (opt & OPT_n) { /* abort if no lease */ 1500 if (opt & OPT_n) { /* abort if no lease */
1501 bb_info_msg("no lease, failing"); 1501 bb_simple_info_msg("no lease, failing");
1502 retval = 1; 1502 retval = 1;
1503 goto ret; 1503 goto ret;
1504 } 1504 }
@@ -1526,7 +1526,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1526 client_data.state = RENEWING; 1526 client_data.state = RENEWING;
1527 client_data.first_secs = 0; /* make secs field count from 0 */ 1527 client_data.first_secs = 0; /* make secs field count from 0 */
1528 change_listen_mode(LISTEN_KERNEL); 1528 change_listen_mode(LISTEN_KERNEL);
1529 log1("entering renew state"); 1529 log1s("entering renew state");
1530 /* fall right through */ 1530 /* fall right through */
1531 case RENEW_REQUESTED: /* manual (SIGUSR1) renew */ 1531 case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
1532 case_RENEW_REQUESTED: 1532 case_RENEW_REQUESTED:
@@ -1559,7 +1559,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1559 */ 1559 */
1560 } 1560 }
1561 /* Timed out or error, enter rebinding state */ 1561 /* Timed out or error, enter rebinding state */
1562 log1("entering rebinding state"); 1562 log1s("entering rebinding state");
1563 client_data.state = REBINDING; 1563 client_data.state = REBINDING;
1564 /* fall right through */ 1564 /* fall right through */
1565 case REBINDING: 1565 case REBINDING:
@@ -1574,7 +1574,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1574 continue; 1574 continue;
1575 } 1575 }
1576 /* Timed out, enter init state */ 1576 /* Timed out, enter init state */
1577 bb_info_msg("lease lost, entering init state"); 1577 bb_simple_info_msg("lease lost, entering init state");
1578 udhcp_run_script(NULL, "deconfig"); 1578 udhcp_run_script(NULL, "deconfig");
1579 client_data.state = INIT_SELECTING; 1579 client_data.state = INIT_SELECTING;
1580 client_data.first_secs = 0; /* make secs field count from 0 */ 1580 client_data.first_secs = 0; /* make secs field count from 0 */
@@ -1660,13 +1660,13 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1660 || memcmp(packet.chaddr, client_data.client_mac, 6) != 0 1660 || memcmp(packet.chaddr, client_data.client_mac, 6) != 0
1661 ) { 1661 ) {
1662//FIXME: need to also check that last 10 bytes are zero 1662//FIXME: need to also check that last 10 bytes are zero
1663 log1("chaddr does not match, ignoring packet"); // log2? 1663 log1("chaddr does not match%s", ", ignoring packet"); // log2?
1664 continue; 1664 continue;
1665 } 1665 }
1666 1666
1667 message = udhcp_get_option(&packet, DHCP_MESSAGE_TYPE); 1667 message = udhcp_get_option(&packet, DHCP_MESSAGE_TYPE);
1668 if (message == NULL) { 1668 if (message == NULL) {
1669 bb_info_msg("no message type option, ignoring packet"); 1669 bb_info_msg("no message type option%s", ", ignoring packet");
1670 continue; 1670 continue;
1671 } 1671 }
1672 1672
@@ -1703,7 +1703,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1703 server_addr = 0; 1703 server_addr = 0;
1704 temp = udhcp_get_option32(&packet, DHCP_SERVER_ID); 1704 temp = udhcp_get_option32(&packet, DHCP_SERVER_ID);
1705 if (!temp) { 1705 if (!temp) {
1706 bb_info_msg("no server ID, using 0.0.0.0"); 1706 bb_simple_info_msg("no server ID, using 0.0.0.0");
1707 } else { 1707 } else {
1708 /* it IS unaligned sometimes, don't "optimize" */ 1708 /* it IS unaligned sometimes, don't "optimize" */
1709 move_from_unaligned32(server_addr, temp); 1709 move_from_unaligned32(server_addr, temp);
@@ -1730,7 +1730,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1730 1730
1731 temp = udhcp_get_option32(&packet, DHCP_LEASE_TIME); 1731 temp = udhcp_get_option32(&packet, DHCP_LEASE_TIME);
1732 if (!temp) { 1732 if (!temp) {
1733 bb_info_msg("no lease time with ACK, using 1 hour lease"); 1733 bb_simple_info_msg("no lease time with ACK, using 1 hour lease");
1734 lease_seconds = 60 * 60; 1734 lease_seconds = 60 * 60;
1735 } else { 1735 } else {
1736 /* it IS unaligned sometimes, don't "optimize" */ 1736 /* it IS unaligned sometimes, don't "optimize" */
@@ -1763,7 +1763,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1763 client_data.interface, 1763 client_data.interface,
1764 arpping_ms) 1764 arpping_ms)
1765 ) { 1765 ) {
1766 bb_info_msg("offered address is in use " 1766 bb_simple_info_msg("offered address is in use "
1767 "(got ARP reply), declining"); 1767 "(got ARP reply), declining");
1768 send_decline(/*xid,*/ server_addr, packet.yiaddr); 1768 send_decline(/*xid,*/ server_addr, packet.yiaddr);
1769 1769
@@ -1827,7 +1827,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1827 if (!temp) { 1827 if (!temp) {
1828 non_matching_svid: 1828 non_matching_svid:
1829 log1("received DHCP NAK with wrong" 1829 log1("received DHCP NAK with wrong"
1830 " server ID, ignoring packet"); 1830 " server ID%s", ", ignoring packet");
1831 continue; 1831 continue;
1832 } 1832 }
1833 move_from_unaligned32(svid, temp); 1833 move_from_unaligned32(svid, temp);
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 022b8721b..3e08ec011 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -582,11 +582,11 @@ static void send_packet_to_client(struct dhcp_packet *dhcp_pkt, int force_broadc
582 || (dhcp_pkt->flags & htons(BROADCAST_FLAG)) 582 || (dhcp_pkt->flags & htons(BROADCAST_FLAG))
583 || dhcp_pkt->ciaddr == 0 583 || dhcp_pkt->ciaddr == 0
584 ) { 584 ) {
585 log1("broadcasting packet to client"); 585 log1s("broadcasting packet to client");
586 ciaddr = INADDR_BROADCAST; 586 ciaddr = INADDR_BROADCAST;
587 chaddr = MAC_BCAST_ADDR; 587 chaddr = MAC_BCAST_ADDR;
588 } else { 588 } else {
589 log1("unicasting packet to client ciaddr"); 589 log1s("unicasting packet to client ciaddr");
590 ciaddr = dhcp_pkt->ciaddr; 590 ciaddr = dhcp_pkt->ciaddr;
591 chaddr = dhcp_pkt->chaddr; 591 chaddr = dhcp_pkt->chaddr;
592 } 592 }
@@ -600,7 +600,7 @@ static void send_packet_to_client(struct dhcp_packet *dhcp_pkt, int force_broadc
600/* Send a packet to gateway_nip using the kernel ip stack */ 600/* Send a packet to gateway_nip using the kernel ip stack */
601static void send_packet_to_relay(struct dhcp_packet *dhcp_pkt) 601static void send_packet_to_relay(struct dhcp_packet *dhcp_pkt)
602{ 602{
603 log1("forwarding packet to relay"); 603 log1s("forwarding packet to relay");
604 604
605 udhcp_send_kernel_packet(dhcp_pkt, 605 udhcp_send_kernel_packet(dhcp_pkt,
606 server_data.server_nip, SERVER_PORT, 606 server_data.server_nip, SERVER_PORT,
@@ -754,7 +754,7 @@ static NOINLINE void send_offer(struct dhcp_packet *oldpacket,
754 } 754 }
755 755
756 if (!packet.yiaddr) { 756 if (!packet.yiaddr) {
757 bb_error_msg("no free IP addresses. OFFER abandoned"); 757 bb_simple_error_msg("no free IP addresses. OFFER abandoned");
758 return; 758 return;
759 } 759 }
760 /* Reserve the IP for a short time hoping to get DHCPREQUEST soon */ 760 /* 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,
765 p_host_name ? (unsigned char)p_host_name[OPT_LEN - OPT_DATA] : 0 765 p_host_name ? (unsigned char)p_host_name[OPT_LEN - OPT_DATA] : 0
766 ); 766 );
767 if (!lease) { 767 if (!lease) {
768 bb_error_msg("no free IP addresses. OFFER abandoned"); 768 bb_simple_error_msg("no free IP addresses. OFFER abandoned");
769 return; 769 return;
770 } 770 }
771 } 771 }
@@ -914,7 +914,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
914 write_pidfile(server_data.pidfile); 914 write_pidfile(server_data.pidfile);
915 /* if (!..) bb_perror_msg("can't create pidfile %s", pidfile); */ 915 /* if (!..) bb_perror_msg("can't create pidfile %s", pidfile); */
916 916
917 bb_info_msg("started, v"BB_VER); 917 bb_simple_info_msg("started, v"BB_VER);
918 918
919 option = udhcp_find_option(server_data.options, DHCP_LEASE_TIME); 919 option = udhcp_find_option(server_data.options, DHCP_LEASE_TIME);
920 server_data.max_lease_sec = DEFAULT_LEASE_TIME; 920 server_data.max_lease_sec = DEFAULT_LEASE_TIME;
@@ -985,7 +985,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
985 if (errno == EINTR) 985 if (errno == EINTR)
986 goto new_tv; 986 goto new_tv;
987 /* < 0 and not EINTR: should not happen */ 987 /* < 0 and not EINTR: should not happen */
988 bb_perror_msg_and_die("poll"); 988 bb_simple_perror_msg_and_die("poll");
989 } 989 }
990 990
991 if (pfds[0].revents) switch (udhcp_sp_read()) { 991 if (pfds[0].revents) switch (udhcp_sp_read()) {
@@ -1019,16 +1019,16 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
1019 continue; 1019 continue;
1020 } 1020 }
1021 if (packet.hlen != 6) { 1021 if (packet.hlen != 6) {
1022 bb_info_msg("MAC length != 6, ignoring packet"); 1022 bb_info_msg("MAC length != 6%s", ", ignoring packet");
1023 continue; 1023 continue;
1024 } 1024 }
1025 if (packet.op != BOOTREQUEST) { 1025 if (packet.op != BOOTREQUEST) {
1026 bb_info_msg("not a REQUEST, ignoring packet"); 1026 bb_info_msg("not a REQUEST%s", ", ignoring packet");
1027 continue; 1027 continue;
1028 } 1028 }
1029 state = udhcp_get_option(&packet, DHCP_MESSAGE_TYPE); 1029 state = udhcp_get_option(&packet, DHCP_MESSAGE_TYPE);
1030 if (state == NULL || state[0] < DHCP_MINTYPE || state[0] > DHCP_MAXTYPE) { 1030 if (state == NULL || state[0] < DHCP_MINTYPE || state[0] > DHCP_MAXTYPE) {
1031 bb_info_msg("no or bad message type option, ignoring packet"); 1031 bb_info_msg("no or bad message type option%s", ", ignoring packet");
1032 continue; 1032 continue;
1033 } 1033 }
1034 1034
@@ -1039,7 +1039,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
1039 move_from_unaligned32(server_id_network_order, server_id_opt); 1039 move_from_unaligned32(server_id_network_order, server_id_opt);
1040 if (server_id_network_order != server_data.server_nip) { 1040 if (server_id_network_order != server_data.server_nip) {
1041 /* client talks to somebody else */ 1041 /* client talks to somebody else */
1042 log1("server ID doesn't match, ignoring"); 1042 log1("server ID doesn't match%s", ", ignoring");
1043 continue; 1043 continue;
1044 } 1044 }
1045 } 1045 }
@@ -1162,7 +1162,7 @@ o DHCPREQUEST generated during REBINDING state:
1162 if (!requested_ip_opt) { 1162 if (!requested_ip_opt) {
1163 requested_nip = packet.ciaddr; 1163 requested_nip = packet.ciaddr;
1164 if (requested_nip == 0) { 1164 if (requested_nip == 0) {
1165 log1("no requested IP and no ciaddr, ignoring"); 1165 log1("no requested IP and no ciaddr%s", ", ignoring");
1166 break; 1166 break;
1167 } 1167 }
1168 } 1168 }
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index 86dcb1af0..ef9447b4b 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -186,7 +186,7 @@ static int sendto_ip4(int sock, const void *msg, int msg_len, struct sockaddr_in
186 err = sendto(sock, msg, msg_len, 0, (struct sockaddr*) to, sizeof(*to)); 186 err = sendto(sock, msg, msg_len, 0, (struct sockaddr*) to, sizeof(*to));
187 err -= msg_len; 187 err -= msg_len;
188 if (err) 188 if (err)
189 bb_perror_msg("sendto"); 189 bb_simple_perror_msg("sendto");
190 return err; 190 return err;
191} 191}
192 192
@@ -273,7 +273,7 @@ int dhcprelay_main(int argc UNUSED_PARAM, char **argv)
273 bb_show_usage(); 273 bb_show_usage();
274 if (argv[3]) { 274 if (argv[3]) {
275 if (!inet_aton(argv[3], &server_addr.sin_addr)) 275 if (!inet_aton(argv[3], &server_addr.sin_addr))
276 bb_perror_msg_and_die("bad server IP"); 276 bb_simple_perror_msg_and_die("bad server IP");
277 } 277 }
278 278
279 iface_list = make_iface_list(argv + 1, &num_sockets); 279 iface_list = make_iface_list(argv + 1, &num_sockets);
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 64af802a3..6d4375237 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -85,14 +85,14 @@ int FAST_FUNC udhcp_recv_kernel_packet(struct dhcp_packet *packet, int fd)
85 memset(packet, 0, sizeof(*packet)); 85 memset(packet, 0, sizeof(*packet));
86 bytes = safe_read(fd, packet, sizeof(*packet)); 86 bytes = safe_read(fd, packet, sizeof(*packet));
87 if (bytes < 0) { 87 if (bytes < 0) {
88 log1("packet read error, ignoring"); 88 log1s("packet read error, ignoring");
89 return bytes; /* returns -1 */ 89 return bytes; /* returns -1 */
90 } 90 }
91 91
92 if (bytes < offsetof(struct dhcp_packet, options) 92 if (bytes < offsetof(struct dhcp_packet, options)
93 || packet->cookie != htonl(DHCP_MAGIC) 93 || packet->cookie != htonl(DHCP_MAGIC)
94 ) { 94 ) {
95 bb_info_msg("packet with bad magic, ignoring"); 95 bb_simple_info_msg("packet with bad magic, ignoring");
96 return -2; 96 return -2;
97 } 97 }
98 log1("received %s", "a packet"); 98 log1("received %s", "a packet");
diff --git a/networking/udhcp/signalpipe.c b/networking/udhcp/signalpipe.c
index 81d1fc01a..7df671245 100644
--- a/networking/udhcp/signalpipe.c
+++ b/networking/udhcp/signalpipe.c
@@ -28,7 +28,7 @@ static void signal_handler(int sig)
28 int sv = errno; 28 int sv = errno;
29 unsigned char ch = sig; /* use char, avoid dealing with partial writes */ 29 unsigned char ch = sig; /* use char, avoid dealing with partial writes */
30 if (write(WRITE_FD, &ch, 1) != 1) 30 if (write(WRITE_FD, &ch, 1) != 1)
31 bb_perror_msg("can't send signal"); 31 bb_simple_perror_msg("can't send signal");
32 errno = sv; 32 errno = sv;
33} 33}
34 34
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 34049c3ee..65a1a8ead 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -87,7 +87,7 @@ int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf)
87 87
88 setsockopt_reuseaddr(fd); 88 setsockopt_reuseaddr(fd);
89 if (setsockopt_broadcast(fd) == -1) 89 if (setsockopt_broadcast(fd) == -1)
90 bb_perror_msg_and_die("SO_BROADCAST"); 90 bb_simple_perror_msg_and_die("SO_BROADCAST");
91 91
92 /* SO_BINDTODEVICE doesn't work on ethernet aliases (ethN:M) */ 92 /* SO_BINDTODEVICE doesn't work on ethernet aliases (ethN:M) */
93 colon = strrchr(inf, ':'); 93 colon = strrchr(inf, ':');
diff --git a/networking/wget.c b/networking/wget.c
index b6f9d605a..9e5a40b6f 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -368,7 +368,7 @@ static void alarm_handler(int sig UNUSED_PARAM)
368{ 368{
369 /* This is theoretically unsafe (uses stdio and malloc in signal handler) */ 369 /* This is theoretically unsafe (uses stdio and malloc in signal handler) */
370 if (G.die_if_timed_out) 370 if (G.die_if_timed_out)
371 bb_error_msg_and_die("download timed out"); 371 bb_simple_error_msg_and_die("download timed out");
372} 372}
373static void set_alarm(void) 373static void set_alarm(void)
374{ 374{
@@ -452,7 +452,7 @@ static char fgets_trim_sanitize(FILE *fp, const char *fmt)
452 452
453 set_alarm(); 453 set_alarm();
454 if (fgets(G.wget_buf, sizeof(G.wget_buf), fp) == NULL) 454 if (fgets(G.wget_buf, sizeof(G.wget_buf), fp) == NULL)
455 bb_perror_msg_and_die("error getting response"); 455 bb_simple_perror_msg_and_die("error getting response");
456 clear_alarm(); 456 clear_alarm();
457 457
458 buf_ptr = strchrnul(G.wget_buf, '\n'); 458 buf_ptr = strchrnul(G.wget_buf, '\n');
@@ -633,7 +633,7 @@ static char *get_sanitized_hdr(FILE *fp)
633 633
634static void reset_beg_range_to_zero(void) 634static void reset_beg_range_to_zero(void)
635{ 635{
636 bb_error_msg("restart failed"); 636 bb_simple_error_msg("restart failed");
637 G.beg_range = 0; 637 G.beg_range = 0;
638 xlseek(G.output_fd, 0, SEEK_SET); 638 xlseek(G.output_fd, 0, SEEK_SET);
639 /* Done at the end instead: */ 639 /* Done at the end instead: */
@@ -651,7 +651,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
651 651
652 if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0) 652 if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0)
653 /* Kernel can have AF_UNIX support disabled */ 653 /* Kernel can have AF_UNIX support disabled */
654 bb_perror_msg_and_die("socketpair"); 654 bb_simple_perror_msg_and_die("socketpair");
655 655
656 if (!strchr(host, ':')) 656 if (!strchr(host, ':'))
657 host = allocated = xasprintf("%s:%u", host, port); 657 host = allocated = xasprintf("%s:%u", host, port);
@@ -724,7 +724,7 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
724 724
725 if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT)) { 725 if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT)) {
726 option_mask32 |= WGET_OPT_NO_CHECK_CERT; 726 option_mask32 |= WGET_OPT_NO_CHECK_CERT;
727 bb_error_msg("note: TLS certificate validation not implemented"); 727 bb_simple_error_msg("note: TLS certificate validation not implemented");
728 } 728 }
729 729
730 servername = xstrdup(host); 730 servername = xstrdup(host);
@@ -733,7 +733,7 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
733 733
734 if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0) 734 if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) != 0)
735 /* Kernel can have AF_UNIX support disabled */ 735 /* Kernel can have AF_UNIX support disabled */
736 bb_perror_msg_and_die("socketpair"); 736 bb_simple_perror_msg_and_die("socketpair");
737 737
738 fflush_all(); 738 fflush_all();
739 pid = BB_MMU ? xfork() : xvfork(); 739 pid = BB_MMU ? xfork() : xvfork();
@@ -785,7 +785,7 @@ static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_
785#endif 785#endif
786 786
787 if (ftpcmd(NULL, NULL, sfp) != 220) 787 if (ftpcmd(NULL, NULL, sfp) != 220)
788 bb_error_msg_and_die("%s", G.wget_buf); 788 bb_simple_error_msg_and_die(G.wget_buf);
789 /* note: ftpcmd() sanitizes G.wget_buf, ok to print */ 789 /* note: ftpcmd() sanitizes G.wget_buf, ok to print */
790 790
791 /* Split username:password pair */ 791 /* Split username:password pair */
@@ -948,7 +948,7 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
948 if (errno != EAGAIN) { 948 if (errno != EAGAIN) {
949 if (ferror(dfp)) { 949 if (ferror(dfp)) {
950 progress_meter(PROGRESS_END); 950 progress_meter(PROGRESS_END);
951 bb_perror_msg_and_die(bb_msg_read_error); 951 bb_simple_perror_msg_and_die(bb_msg_read_error);
952 } 952 }
953 break; /* EOF, not error */ 953 break; /* EOF, not error */
954 } 954 }
@@ -961,7 +961,7 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
961# if ENABLE_FEATURE_WGET_TIMEOUT 961# if ENABLE_FEATURE_WGET_TIMEOUT
962 if (second_cnt != 0 && --second_cnt == 0) { 962 if (second_cnt != 0 && --second_cnt == 0) {
963 progress_meter(PROGRESS_END); 963 progress_meter(PROGRESS_END);
964 bb_error_msg_and_die("download timed out"); 964 bb_simple_error_msg_and_die("download timed out");
965 } 965 }
966# endif 966# endif
967 /* We used to loop back to poll here, 967 /* We used to loop back to poll here,
@@ -1014,7 +1014,7 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
1014 G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */ 1014 G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */
1015 progress_meter(PROGRESS_END); 1015 progress_meter(PROGRESS_END);
1016 if (G.content_len != 0) { 1016 if (G.content_len != 0) {
1017 bb_perror_msg_and_die("connection closed prematurely"); 1017 bb_simple_perror_msg_and_die("connection closed prematurely");
1018 /* GNU wget says "DATE TIME (NN MB/s) - Connection closed at byte NNN. Retrying." */ 1018 /* GNU wget says "DATE TIME (NN MB/s) - Connection closed at byte NNN. Retrying." */
1019 } 1019 }
1020 1020
@@ -1348,7 +1348,7 @@ However, in real world it was observed that some web servers
1348 } 1348 }
1349 if (key == KEY_location && status >= 300) { 1349 if (key == KEY_location && status >= 300) {
1350 if (--redir_limit == 0) 1350 if (--redir_limit == 0)
1351 bb_error_msg_and_die("too many redirections"); 1351 bb_simple_error_msg_and_die("too many redirections");
1352 fclose(sfp); 1352 fclose(sfp);
1353 if (str[0] == '/') { 1353 if (str[0] == '/') {
1354 free(redirected_path); 1354 free(redirected_path);
diff --git a/networking/zcip.c b/networking/zcip.c
index f95b6f7fb..134dfb2df 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -276,7 +276,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
276 if (inet_aton(l_opt, &net) == 0 276 if (inet_aton(l_opt, &net) == 0
277 || (net.s_addr & htonl(IN_CLASSB_NET)) != net.s_addr 277 || (net.s_addr & htonl(IN_CLASSB_NET)) != net.s_addr
278 ) { 278 ) {
279 bb_error_msg_and_die("invalid network address"); 279 bb_simple_error_msg_and_die("invalid network address");
280 } 280 }
281 G.localnet_ip = ntohl(net.s_addr); 281 G.localnet_ip = ntohl(net.s_addr);
282 } 282 }
@@ -285,7 +285,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
285 if (inet_aton(r_opt, &ip) == 0 285 if (inet_aton(r_opt, &ip) == 0
286 || (ntohl(ip.s_addr) & IN_CLASSB_NET) != G.localnet_ip 286 || (ntohl(ip.s_addr) & IN_CLASSB_NET) != G.localnet_ip
287 ) { 287 ) {
288 bb_error_msg_and_die("invalid link address"); 288 bb_simple_error_msg_and_die("invalid link address");
289 } 289 }
290 chosen_nip = ip.s_addr; 290 chosen_nip = ip.s_addr;
291 } 291 }
@@ -473,7 +473,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
473 473
474 // Read ARP packet 474 // Read ARP packet
475 if (safe_read(sock_fd, &p, sizeof(p)) < 0) { 475 if (safe_read(sock_fd, &p, sizeof(p)) < 0) {
476 bb_perror_msg_and_die(bb_msg_read_error); 476 bb_simple_perror_msg_and_die(bb_msg_read_error);
477 } 477 }
478 478
479 if (p.eth.ether_type != htons(ETHERTYPE_ARP)) 479 if (p.eth.ether_type != htons(ETHERTYPE_ARP))
diff --git a/printutils/lpr.c b/printutils/lpr.c
index 7acb6c357..77d1a79a4 100644
--- a/printutils/lpr.c
+++ b/printutils/lpr.c
@@ -167,7 +167,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
167 // LPR ------------------------ 167 // LPR ------------------------
168 // 168 //
169 if (opts & LPR_V) 169 if (opts & LPR_V)
170 bb_error_msg("connected to server"); 170 bb_simple_error_msg("connected to server");
171 171
172 job = getpid() % 1000; 172 job = getpid() % 1000;
173 hostname = safe_gethostname(); 173 hostname = safe_gethostname();
@@ -206,7 +206,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
206 * Standard lpr works around it by refusing to send such jobs: 206 * Standard lpr works around it by refusing to send such jobs:
207 */ 207 */
208 if (st.st_size == 0) { 208 if (st.st_size == 0) {
209 bb_error_msg("nothing to print"); 209 bb_simple_error_msg("nothing to print");
210 continue; 210 continue;
211 } 211 }
212 212
@@ -246,7 +246,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
246 246
247 // send control file 247 // send control file
248 if (opts & LPR_V) 248 if (opts & LPR_V)
249 bb_error_msg("sending control file"); 249 bb_simple_error_msg("sending control file");
250 /* "Acknowledgement processing must occur as usual 250 /* "Acknowledgement processing must occur as usual
251 * after the command is sent." */ 251 * after the command is sent." */
252 cflen = (unsigned)strlen(controlfile); 252 cflen = (unsigned)strlen(controlfile);
@@ -262,12 +262,12 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
262 262
263 // send data file, with name "dfaXXX" 263 // send data file, with name "dfaXXX"
264 if (opts & LPR_V) 264 if (opts & LPR_V)
265 bb_error_msg("sending data file"); 265 bb_simple_error_msg("sending data file");
266 fdprintf(fd, "\x3" "%"OFF_FMT"u d%s\n", st.st_size, remote_filename); 266 fdprintf(fd, "\x3" "%"OFF_FMT"u d%s\n", st.st_size, remote_filename);
267 get_response_or_say_and_die(fd, "sending data file"); 267 get_response_or_say_and_die(fd, "sending data file");
268 if (bb_copyfd_size(dfd, fd, st.st_size) != st.st_size) { 268 if (bb_copyfd_size(dfd, fd, st.st_size) != st.st_size) {
269 // We're screwed. We sent less bytes than we advertised. 269 // We're screwed. We sent less bytes than we advertised.
270 bb_error_msg_and_die("local file changed size?!"); 270 bb_simple_error_msg_and_die("local file changed size?!");
271 } 271 }
272 write(fd, "", 1); // send ACK 272 write(fd, "", 1); // send ACK
273 get_response_or_say_and_die(fd, "sending data file"); 273 get_response_or_say_and_die(fd, "sending data file");
@@ -283,7 +283,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
283 283
284 // say job accepted 284 // say job accepted
285 if (opts & LPR_V) 285 if (opts & LPR_V)
286 bb_error_msg("job accepted"); 286 bb_simple_error_msg("job accepted");
287 287
288 // next, please! 288 // next, please!
289 job = (job + 1) % 1000; 289 job = (job + 1) % 1000;
diff --git a/procps/kill.c b/procps/kill.c
index a30a79dd8..4a2eab613 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -268,7 +268,7 @@ int kill_main(int argc UNUSED_PARAM, char **argv)
268#if ENABLE_KILL || ENABLE_KILLALL 268#if ENABLE_KILL || ENABLE_KILLALL
269 /* Pid or name is required for kill/killall */ 269 /* Pid or name is required for kill/killall */
270 if (!arg) { 270 if (!arg) {
271 bb_error_msg("you need to specify whom to kill"); 271 bb_simple_error_msg("you need to specify whom to kill");
272 return EXIT_FAILURE; 272 return EXIT_FAILURE;
273 } 273 }
274 274
diff --git a/procps/mpstat.c b/procps/mpstat.c
index 4ea1b5d97..52a436a55 100644
--- a/procps/mpstat.c
+++ b/procps/mpstat.c
@@ -931,7 +931,7 @@ int mpstat_main(int argc UNUSED_PARAM, char **argv)
931 /* Get CPU number */ 931 /* Get CPU number */
932 unsigned n = xatoi_positive(t); 932 unsigned n = xatoi_positive(t);
933 if (n >= G.cpu_nr) 933 if (n >= G.cpu_nr)
934 bb_error_msg_and_die("not that many processors"); 934 bb_simple_error_msg_and_die("not that many processors");
935 n++; 935 n++;
936 G.cpu_bitmap[n >> 3] |= 1 << (n & 7); 936 G.cpu_bitmap[n >> 3] |= 1 << (n & 7);
937 } 937 }
diff --git a/procps/powertop.c b/procps/powertop.c
index e70f5433b..d508b5f78 100644
--- a/procps/powertop.c
+++ b/procps/powertop.c
@@ -657,7 +657,7 @@ static void show_timerstats(void)
657 } 657 }
658 } else { 658 } else {
659 bb_putchar('\n'); 659 bb_putchar('\n');
660 bb_error_msg("no stats available; run as root or" 660 bb_simple_error_msg("no stats available; run as root or"
661 " enable the timer_stats module"); 661 " enable the timer_stats module");
662 } 662 }
663} 663}
@@ -707,7 +707,7 @@ int powertop_main(int argc UNUSED_PARAM, char UNUSED_PARAM **argv)
707 707
708 /* Print warning when we don't have superuser privileges */ 708 /* Print warning when we don't have superuser privileges */
709 if (geteuid() != 0) 709 if (geteuid() != 0)
710 bb_error_msg("run as root to collect enough information"); 710 bb_simple_error_msg("run as root to collect enough information");
711 711
712 /* Get number of CPUs */ 712 /* Get number of CPUs */
713 G.total_cpus = get_cpu_count(); 713 G.total_cpus = get_cpu_count();
diff --git a/procps/pstree.c b/procps/pstree.c
index 1d124d2d2..67b711168 100644
--- a/procps/pstree.c
+++ b/procps/pstree.c
@@ -404,7 +404,7 @@ int pstree_main(int argc UNUSED_PARAM, char **argv)
404 else { 404 else {
405 dump_by_user(find_proc(1), uid); 405 dump_by_user(find_proc(1), uid);
406 if (!G.dumped) { 406 if (!G.dumped) {
407 bb_error_msg_and_die("no processes found"); 407 bb_simple_error_msg_and_die("no processes found");
408 } 408 }
409 } 409 }
410 410
diff --git a/procps/top.c b/procps/top.c
index 89f9d23f4..8fe53324f 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -1229,7 +1229,7 @@ int top_main(int argc UNUSED_PARAM, char **argv)
1229#endif 1229#endif
1230 } /* end of "while we read /proc" */ 1230 } /* end of "while we read /proc" */
1231 if (ntop == 0) { 1231 if (ntop == 0) {
1232 bb_error_msg("no process info in /proc"); 1232 bb_simple_error_msg("no process info in /proc");
1233 break; 1233 break;
1234 } 1234 }
1235 1235
diff --git a/runit/chpst.c b/runit/chpst.c
index 5e77245f6..af777568f 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -270,7 +270,7 @@ static void limit(int what, long l)
270 else 270 else
271 r.rlim_cur = l; 271 r.rlim_cur = l;
272 if (setrlimit(what, &r) == -1) 272 if (setrlimit(what, &r) == -1)
273 bb_perror_msg_and_die("setrlimit"); 273 bb_simple_perror_msg_and_die("setrlimit");
274} 274}
275 275
276int chpst_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 276int chpst_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -467,12 +467,12 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
467 if (opt & OPT_n) { 467 if (opt & OPT_n) {
468 errno = 0; 468 errno = 0;
469 if (nice(xatoi(nicestr)) == -1) 469 if (nice(xatoi(nicestr)) == -1)
470 bb_perror_msg_and_die("nice"); 470 bb_simple_perror_msg_and_die("nice");
471 } 471 }
472 472
473 if (opt & OPT_u) { 473 if (opt & OPT_u) {
474 if (setgroups(1, &ugid.gid) == -1) 474 if (setgroups(1, &ugid.gid) == -1)
475 bb_perror_msg_and_die("setgroups"); 475 bb_simple_perror_msg_and_die("setgroups");
476 xsetgid(ugid.gid); 476 xsetgid(ugid.gid);
477 xsetuid(ugid.uid); 477 xsetuid(ugid.uid);
478 } 478 }
diff --git a/runit/svlogd.c b/runit/svlogd.c
index c9e5346d1..a250058a1 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -274,7 +274,7 @@ static void warnx(const char *m0, const char *m1)
274} 274}
275static void pause_nomem(void) 275static void pause_nomem(void)
276{ 276{
277 bb_error_msg(PAUSE"out of memory"); 277 bb_simple_error_msg(PAUSE"out of memory");
278 sleep(3); 278 sleep(3);
279} 279}
280static void pause1cannot(const char *m0) 280static void pause1cannot(const char *m0)
diff --git a/selinux/chcon.c b/selinux/chcon.c
index 5bf91710c..afe7f713d 100644
--- a/selinux/chcon.c
+++ b/selinux/chcon.c
@@ -107,7 +107,7 @@ static int FAST_FUNC change_filedir_context(
107 107
108 context_string = context_str(context); 108 context_string = context_str(context);
109 if (!context_string) { 109 if (!context_string) {
110 bb_error_msg("can't obtain security context in text expression"); 110 bb_simple_error_msg("can't obtain security context in text expression");
111 goto skip; 111 goto skip;
112 } 112 }
113 113
@@ -194,7 +194,7 @@ int chcon_main(int argc UNUSED_PARAM, char **argv)
194 /* specified_context is never NULL - 194 /* specified_context is never NULL -
195 * "-1" in opt_complementary prevents this. */ 195 * "-1" in opt_complementary prevents this. */
196 if (!argv[0]) 196 if (!argv[0])
197 bb_error_msg_and_die("too few arguments"); 197 bb_simple_error_msg_and_die("too few arguments");
198 } 198 }
199 199
200 for (i = 0; (fname = argv[i]) != NULL; i++) { 200 for (i = 0; (fname = argv[i]) != NULL; i++) {
diff --git a/selinux/getenforce.c b/selinux/getenforce.c
index 0286dd0be..f082ba614 100644
--- a/selinux/getenforce.c
+++ b/selinux/getenforce.c
@@ -29,12 +29,12 @@ int getenforce_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
29 29
30 rc = is_selinux_enabled(); 30 rc = is_selinux_enabled();
31 if (rc < 0) 31 if (rc < 0)
32 bb_error_msg_and_die("is_selinux_enabled() failed"); 32 bb_simple_error_msg_and_die("is_selinux_enabled() failed");
33 33
34 if (rc == 1) { 34 if (rc == 1) {
35 rc = security_getenforce(); 35 rc = security_getenforce();
36 if (rc < 0) 36 if (rc < 0)
37 bb_error_msg_and_die("getenforce() failed"); 37 bb_simple_error_msg_and_die("getenforce() failed");
38 38
39 if (rc) 39 if (rc)
40 puts("Enforcing"); 40 puts("Enforcing");
diff --git a/selinux/getsebool.c b/selinux/getsebool.c
index 6d7805c8d..36ddd45b9 100644
--- a/selinux/getsebool.c
+++ b/selinux/getsebool.c
@@ -40,7 +40,7 @@ int getsebool_main(int argc, char **argv)
40 40
41 rc = security_get_boolean_names(&names, &len); 41 rc = security_get_boolean_names(&names, &len);
42 if (rc) 42 if (rc)
43 bb_perror_msg_and_die("can't get boolean names"); 43 bb_simple_perror_msg_and_die("can't get boolean names");
44 44
45 if (!len) { 45 if (!len) {
46 puts("No booleans"); 46 puts("No booleans");
diff --git a/selinux/load_policy.c b/selinux/load_policy.c
index b7930839c..eac6ba6c1 100644
--- a/selinux/load_policy.c
+++ b/selinux/load_policy.c
@@ -31,7 +31,7 @@ int load_policy_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
31 31
32 rc = selinux_mkload_policy(1); 32 rc = selinux_mkload_policy(1);
33 if (rc < 0) { 33 if (rc < 0) {
34 bb_perror_msg_and_die("can't load policy"); 34 bb_simple_perror_msg_and_die("can't load policy");
35 } 35 }
36 36
37 return 0; 37 return 0;
diff --git a/selinux/runcon.c b/selinux/runcon.c
index a5a394427..bc4fa23e0 100644
--- a/selinux/runcon.c
+++ b/selinux/runcon.c
@@ -65,7 +65,7 @@ static context_t runcon_compute_new_context(char *user, char *role, char *type,
65 security_context_t cur_context; 65 security_context_t cur_context;
66 66
67 if (getcon(&cur_context)) 67 if (getcon(&cur_context))
68 bb_error_msg_and_die("can't get current context"); 68 bb_simple_error_msg_and_die("can't get current context");
69 69
70 if (compute_trans) { 70 if (compute_trans) {
71 security_context_t file_context, new_context; 71 security_context_t file_context, new_context;
@@ -75,7 +75,7 @@ static context_t runcon_compute_new_context(char *user, char *role, char *type,
75 command); 75 command);
76 if (security_compute_create(cur_context, file_context, 76 if (security_compute_create(cur_context, file_context,
77 SECCLASS_PROCESS, &new_context)) 77 SECCLASS_PROCESS, &new_context))
78 bb_error_msg_and_die("unable to compute a new context"); 78 bb_simple_error_msg_and_die("unable to compute a new context");
79 cur_context = new_context; 79 cur_context = new_context;
80 } 80 }
81 81
@@ -137,7 +137,7 @@ int runcon_main(int argc UNUSED_PARAM, char **argv)
137 if (!(opts & OPTS_CONTEXT_COMPONENT)) { 137 if (!(opts & OPTS_CONTEXT_COMPONENT)) {
138 context = *argv++; 138 context = *argv++;
139 if (!argv[0]) 139 if (!argv[0])
140 bb_error_msg_and_die("no command given"); 140 bb_simple_error_msg_and_die("no command given");
141 } 141 }
142 142
143 if (context) { 143 if (context) {
diff --git a/selinux/sestatus.c b/selinux/sestatus.c
index 6954aca70..098a4d189 100644
--- a/selinux/sestatus.c
+++ b/selinux/sestatus.c
@@ -216,5 +216,5 @@ int sestatus_main(int argc UNUSED_PARAM, char **argv)
216 return 0; 216 return 0;
217 217
218 error: 218 error:
219 bb_perror_msg_and_die("libselinux returns unknown state"); 219 bb_simple_perror_msg_and_die("libselinux returns unknown state");
220} 220}
diff --git a/selinux/setenforce.c b/selinux/setenforce.c
index c28de6ec5..996034f8e 100644
--- a/selinux/setenforce.c
+++ b/selinux/setenforce.c
@@ -49,7 +49,7 @@ int setenforce_main(int argc UNUSED_PARAM, char **argv)
49 continue; 49 continue;
50 rc = security_setenforce(i & 1); 50 rc = security_setenforce(i & 1);
51 if (rc < 0) 51 if (rc < 0)
52 bb_perror_msg_and_die("setenforce() failed"); 52 bb_simple_perror_msg_and_die("setenforce() failed");
53 return 0; 53 return 0;
54 } 54 }
55 55
diff --git a/selinux/setfiles.c b/selinux/setfiles.c
index 740eaf8fb..55bfb4d02 100644
--- a/selinux/setfiles.c
+++ b/selinux/setfiles.c
@@ -182,7 +182,7 @@ static void inc_err(void)
182{ 182{
183 nerr++; 183 nerr++;
184 if (nerr > 9 && !FLAG_d_debug) { 184 if (nerr > 9 && !FLAG_d_debug) {
185 bb_error_msg_and_die("exiting after 10 errors"); 185 bb_simple_error_msg_and_die("exiting after 10 errors");
186 } 186 }
187} 187}
188 188
diff --git a/selinux/setsebool.c b/selinux/setsebool.c
index 579118172..2af23acd7 100644
--- a/selinux/setsebool.c
+++ b/selinux/setsebool.c
@@ -46,7 +46,7 @@ int setsebool_main(int argc, char **argv)
46 } 46 }
47 47
48 if (security_set_boolean(argv[1], value) < 0) 48 if (security_set_boolean(argv[1], value) < 0)
49 bb_error_msg_and_die("can't set boolean"); 49 bb_simple_error_msg_and_die("can't set boolean");
50 50
51 return 0; 51 return 0;
52} 52}
diff --git a/shell/hush.c b/shell/hush.c
index f82747f74..19b97e2a5 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1398,7 +1398,7 @@ static void syntax_error(unsigned lineno UNUSED_PARAM, const char *msg)
1398 if (msg) 1398 if (msg)
1399 bb_error_msg("syntax error: %s", msg); 1399 bb_error_msg("syntax error: %s", msg);
1400 else 1400 else
1401 bb_error_msg("syntax error"); 1401 bb_simple_error_msg("syntax error");
1402 die_if_script(); 1402 die_if_script();
1403} 1403}
1404 1404
@@ -1637,7 +1637,7 @@ static int refill_HFILE_and_getc(HFILE *fp)
1637 fp->cur = fp->buf; 1637 fp->cur = fp->buf;
1638 n = safe_read(fp->fd, fp->buf, sizeof(fp->buf)); 1638 n = safe_read(fp->fd, fp->buf, sizeof(fp->buf));
1639 if (n < 0) { 1639 if (n < 0) {
1640 bb_perror_msg("read error"); 1640 bb_simple_perror_msg("read error");
1641 n = 0; 1641 n = 0;
1642 } 1642 }
1643 fp->end = fp->buf + n; 1643 fp->end = fp->buf + n;
@@ -2282,7 +2282,7 @@ static int set_local_var(char *str, unsigned flags)
2282 2282
2283 eq_sign = strchr(str, '='); 2283 eq_sign = strchr(str, '=');
2284 if (HUSH_DEBUG && !eq_sign) 2284 if (HUSH_DEBUG && !eq_sign)
2285 bb_error_msg_and_die("BUG in setvar"); 2285 bb_simple_error_msg_and_die("BUG in setvar");
2286 2286
2287 name_len = eq_sign - str + 1; /* including '=' */ 2287 name_len = eq_sign - str + 1; /* including '=' */
2288 cur_pp = &G.top_var; 2288 cur_pp = &G.top_var;
@@ -2505,7 +2505,7 @@ static void set_vars_and_save_old(char **strings)
2505 2505
2506 eq = strchr(*s, '='); 2506 eq = strchr(*s, '=');
2507 if (HUSH_DEBUG && !eq) 2507 if (HUSH_DEBUG && !eq)
2508 bb_error_msg_and_die("BUG in varexp4"); 2508 bb_simple_error_msg_and_die("BUG in varexp4");
2509 var_pp = get_ptr_to_local_var(*s, eq - *s); 2509 var_pp = get_ptr_to_local_var(*s, eq - *s);
2510 if (var_pp) { 2510 if (var_pp) {
2511 var_p = *var_pp; 2511 var_p = *var_pp;
@@ -4246,7 +4246,7 @@ static int parse_redir_right_fd(o_string *as_string, struct in_str *input)
4246 4246
4247//TODO: this is the place to catch ">&file" bashism (redirect both fd 1 and 2) 4247//TODO: this is the place to catch ">&file" bashism (redirect both fd 1 and 2)
4248 4248
4249 bb_error_msg("ambiguous redirect"); 4249 bb_simple_error_msg("ambiguous redirect");
4250 return REDIRFD_SYNTAX_ERR; 4250 return REDIRFD_SYNTAX_ERR;
4251} 4251}
4252 4252
@@ -6956,7 +6956,7 @@ static char *expand_string_to_string(const char *str, int EXP_flags, int do_unba
6956 } else { 6956 } else {
6957 if (HUSH_DEBUG) 6957 if (HUSH_DEBUG)
6958 if (list[1]) 6958 if (list[1])
6959 bb_error_msg_and_die("BUG in varexp2"); 6959 bb_simple_error_msg_and_die("BUG in varexp2");
6960 /* actually, just move string 2*sizeof(char*) bytes back */ 6960 /* actually, just move string 2*sizeof(char*) bytes back */
6961 overlapping_strcpy((char*)list, list[0]); 6961 overlapping_strcpy((char*)list, list[0]);
6962 if (do_unbackslash) 6962 if (do_unbackslash)
@@ -7217,7 +7217,7 @@ static void re_execute_shell(char ***to_free, const char *s,
7217 if (argv[0][0] == '/') 7217 if (argv[0][0] == '/')
7218 execve(argv[0], argv, pp); 7218 execve(argv[0], argv, pp);
7219 xfunc_error_retval = 127; 7219 xfunc_error_retval = 127;
7220 bb_error_msg_and_die("can't re-execute the shell"); 7220 bb_simple_error_msg_and_die("can't re-execute the shell");
7221} 7221}
7222#endif /* !BB_MMU */ 7222#endif /* !BB_MMU */
7223 7223
@@ -7919,7 +7919,7 @@ static void leave_var_nest_level(void)
7919 G.var_nest_level--; 7919 G.var_nest_level--;
7920 debug_printf_env("var_nest_level-- %u\n", G.var_nest_level); 7920 debug_printf_env("var_nest_level-- %u\n", G.var_nest_level);
7921 if (HUSH_DEBUG && (int)G.var_nest_level < 0) 7921 if (HUSH_DEBUG && (int)G.var_nest_level < 0)
7922 bb_error_msg_and_die("BUG: nesting underflow"); 7922 bb_simple_error_msg_and_die("BUG: nesting underflow");
7923 7923
7924 remove_nested_vars(); 7924 remove_nested_vars();
7925} 7925}
@@ -8776,7 +8776,7 @@ static int checkjobs(struct pipe *fg_pipe, pid_t waitfor_pid)
8776 childpid = waitpid(-1, &status, attributes); 8776 childpid = waitpid(-1, &status, attributes);
8777 if (childpid <= 0) { 8777 if (childpid <= 0) {
8778 if (childpid && errno != ECHILD) 8778 if (childpid && errno != ECHILD)
8779 bb_perror_msg("waitpid"); 8779 bb_simple_perror_msg("waitpid");
8780#if ENABLE_HUSH_FAST 8780#if ENABLE_HUSH_FAST
8781 else { /* Until next SIGCHLD, waitpid's are useless */ 8781 else { /* Until next SIGCHLD, waitpid's are useless */
8782 G.we_have_children = (childpid == 0); 8782 G.we_have_children = (childpid == 0);
@@ -9308,7 +9308,7 @@ static NOINLINE int run_pipe(struct pipe *pi)
9308 argv_expanded = NULL; 9308 argv_expanded = NULL;
9309 if (command->pid < 0) { /* [v]fork failed */ 9309 if (command->pid < 0) { /* [v]fork failed */
9310 /* Clearly indicate, was it fork or vfork */ 9310 /* Clearly indicate, was it fork or vfork */
9311 bb_perror_msg(BB_MMU ? "vfork"+1 : "vfork"); 9311 bb_simple_perror_msg(BB_MMU ? "vfork"+1 : "vfork");
9312 } else { 9312 } else {
9313 pi->alive_cmds++; 9313 pi->alive_cmds++;
9314#if ENABLE_HUSH_JOB 9314#if ENABLE_HUSH_JOB
@@ -10617,7 +10617,7 @@ static int FAST_FUNC builtin_read(char **argv)
10617 } 10617 }
10618 10618
10619 if ((uintptr_t)r > 1) { 10619 if ((uintptr_t)r > 1) {
10620 bb_error_msg("%s", r); 10620 bb_simple_error_msg(r);
10621 r = (char*)(uintptr_t)1; 10621 r = (char*)(uintptr_t)1;
10622 } 10622 }
10623 10623
@@ -10862,7 +10862,7 @@ static int FAST_FUNC builtin_unset(char **argv)
10862 if (opts == (unsigned)-1) 10862 if (opts == (unsigned)-1)
10863 return EXIT_FAILURE; 10863 return EXIT_FAILURE;
10864 if (opts == 3) { 10864 if (opts == 3) {
10865 bb_error_msg("unset: -v and -f are exclusive"); 10865 bb_simple_error_msg("unset: -v and -f are exclusive");
10866 return EXIT_FAILURE; 10866 return EXIT_FAILURE;
10867 } 10867 }
10868 argv += optind; 10868 argv += optind;
@@ -11025,7 +11025,7 @@ Test that VAR is a valid variable name?
11025 11025
11026 optstring = *++argv; 11026 optstring = *++argv;
11027 if (!optstring || !(var = *++argv)) { 11027 if (!optstring || !(var = *++argv)) {
11028 bb_error_msg("usage: getopts OPTSTRING VAR [ARGS]"); 11028 bb_simple_error_msg("usage: getopts OPTSTRING VAR [ARGS]");
11029 return EXIT_FAILURE; 11029 return EXIT_FAILURE;
11030 } 11030 }
11031 11031
@@ -11254,7 +11254,7 @@ static int FAST_FUNC builtin_trap(char **argv)
11254 } 11254 }
11255 11255
11256 if (!argv[1]) { /* no second arg */ 11256 if (!argv[1]) { /* no second arg */
11257 bb_error_msg("trap: invalid arguments"); 11257 bb_simple_error_msg("trap: invalid arguments");
11258 return EXIT_FAILURE; 11258 return EXIT_FAILURE;
11259 } 11259 }
11260 11260
@@ -11295,7 +11295,7 @@ static struct pipe *parse_jobspec(const char *str)
11295 /* It is "%%", "%+" or "%" - current job */ 11295 /* It is "%%", "%+" or "%" - current job */
11296 jobnum = G.last_jobid; 11296 jobnum = G.last_jobid;
11297 if (jobnum == 0) { 11297 if (jobnum == 0) {
11298 bb_error_msg("no current job"); 11298 bb_simple_error_msg("no current job");
11299 return NULL; 11299 return NULL;
11300 } 11300 }
11301 } 11301 }
@@ -11372,7 +11372,7 @@ static int FAST_FUNC builtin_fg_bg(char **argv)
11372 delete_finished_job(pi); 11372 delete_finished_job(pi);
11373 return EXIT_SUCCESS; 11373 return EXIT_SUCCESS;
11374 } 11374 }
11375 bb_perror_msg("kill (SIGCONT)"); 11375 bb_simple_perror_msg("kill (SIGCONT)");
11376 } 11376 }
11377 11377
11378 if (argv[0][0] == 'f') { 11378 if (argv[0][0] == 'f') {
diff --git a/shell/shell_common.c b/shell/shell_common.c
index e0582adfb..a93533903 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -619,7 +619,7 @@ shell_builtin_ulimit(char **argv)
619 limit.rlim_cur = val; 619 limit.rlim_cur = val;
620//bb_error_msg("setrlimit(%d, %lld, %lld)", limits_tbl[i].cmd, (long long)limit.rlim_cur, (long long)limit.rlim_max); 620//bb_error_msg("setrlimit(%d, %lld, %lld)", limits_tbl[i].cmd, (long long)limit.rlim_cur, (long long)limit.rlim_max);
621 if (setrlimit(limits_tbl[i].cmd, &limit) < 0) { 621 if (setrlimit(limits_tbl[i].cmd, &limit) < 0) {
622 bb_perror_msg("error setting limit"); 622 bb_simple_perror_msg("error setting limit");
623 return EXIT_FAILURE; 623 return EXIT_FAILURE;
624 } 624 }
625 } 625 }
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index 17b6ca235..bdd0b6325 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -244,7 +244,7 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
244 if (n < 0) { 244 if (n < 0) {
245 if (errno == EINTR) 245 if (errno == EINTR)
246 continue; 246 continue;
247 bb_perror_msg(READ_ERROR); 247 bb_simple_perror_msg(READ_ERROR);
248 break; 248 break;
249 } 249 }
250 start[n] = '\0'; 250 start[n] = '\0';
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index ea41fc0c8..1e1f1347f 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -88,7 +88,7 @@ static void error_exit(const char *str)
88} 88}
89#else 89#else
90/* On Linux, shmdt is not mandatory on exit */ 90/* On Linux, shmdt is not mandatory on exit */
91# define error_exit(str) bb_perror_msg_and_die(str) 91# define error_exit(str) bb_simple_perror_msg_and_die(str)
92#endif 92#endif
93 93
94/* 94/*
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index d0dd1bd20..0e226124a 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -572,12 +572,12 @@ static void ipcsyslog_init(void)
572 572
573 G.shmid = shmget(KEY_ID, G.shm_size, IPC_CREAT | 0644); 573 G.shmid = shmget(KEY_ID, G.shm_size, IPC_CREAT | 0644);
574 if (G.shmid == -1) { 574 if (G.shmid == -1) {
575 bb_perror_msg_and_die("shmget"); 575 bb_simple_perror_msg_and_die("shmget");
576 } 576 }
577 577
578 G.shbuf = shmat(G.shmid, NULL, 0); 578 G.shbuf = shmat(G.shmid, NULL, 0);
579 if (G.shbuf == (void*) -1L) { /* shmat has bizarre error return */ 579 if (G.shbuf == (void*) -1L) { /* shmat has bizarre error return */
580 bb_perror_msg_and_die("shmat"); 580 bb_simple_perror_msg_and_die("shmat");
581 } 581 }
582 582
583 memset(G.shbuf, 0, G.shm_size); 583 memset(G.shbuf, 0, G.shm_size);
@@ -592,7 +592,7 @@ static void ipcsyslog_init(void)
592 if (G.s_semid != -1) 592 if (G.s_semid != -1)
593 return; 593 return;
594 } 594 }
595 bb_perror_msg_and_die("semget"); 595 bb_simple_perror_msg_and_die("semget");
596 } 596 }
597} 597}
598 598
@@ -603,7 +603,7 @@ static void log_to_shmem(const char *msg)
603 int len; 603 int len;
604 604
605 if (semop(G.s_semid, G.SMwdn, 3) == -1) { 605 if (semop(G.s_semid, G.SMwdn, 3) == -1) {
606 bb_perror_msg_and_die("SMwdn"); 606 bb_simple_perror_msg_and_die("SMwdn");
607 } 607 }
608 608
609 /* Circular Buffer Algorithm: 609 /* Circular Buffer Algorithm:
@@ -631,7 +631,7 @@ static void log_to_shmem(const char *msg)
631 goto again; 631 goto again;
632 } 632 }
633 if (semop(G.s_semid, G.SMwup, 1) == -1) { 633 if (semop(G.s_semid, G.SMwup, 1) == -1) {
634 bb_perror_msg_and_die("SMwup"); 634 bb_simple_perror_msg_and_die("SMwup");
635 } 635 }
636 if (DEBUG) 636 if (DEBUG)
637 printf("tail:%d\n", G.shbuf->tail); 637 printf("tail:%d\n", G.shbuf->tail);
diff --git a/util-linux/acpid.c b/util-linux/acpid.c
index 7274b6866..95f8150e2 100644
--- a/util-linux/acpid.c
+++ b/util-linux/acpid.c
@@ -148,7 +148,7 @@ static void process_event(const char *event)
148 const char *args[] = { "run-parts", handler, NULL }; 148 const char *args[] = { "run-parts", handler, NULL };
149 149
150 // log the event 150 // log the event
151 bb_error_msg("%s", event); 151 bb_simple_error_msg(event);
152 152
153 // spawn handler 153 // spawn handler
154 // N.B. run-parts would require scripts to have #!/bin/sh 154 // N.B. run-parts would require scripts to have #!/bin/sh
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index b797c7b2a..a1f269142 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -74,7 +74,7 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
74 opts = getopt32(argv, "cs:+n:+r", &len, &level); 74 opts = getopt32(argv, "cs:+n:+r", &len, &level);
75 if (opts & OPT_n) { 75 if (opts & OPT_n) {
76 if (klogctl(8, NULL, (long) level)) 76 if (klogctl(8, NULL, (long) level))
77 bb_perror_msg_and_die("klogctl"); 77 bb_simple_perror_msg_and_die("klogctl");
78 return EXIT_SUCCESS; 78 return EXIT_SUCCESS;
79 } 79 }
80 80
@@ -88,7 +88,7 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
88 buf = xmalloc(len); 88 buf = xmalloc(len);
89 len = klogctl(3 + (opts & OPT_c), buf, len); /* read ring buffer */ 89 len = klogctl(3 + (opts & OPT_c), buf, len); /* read ring buffer */
90 if (len < 0) 90 if (len < 0)
91 bb_perror_msg_and_die("klogctl"); 91 bb_simple_perror_msg_and_die("klogctl");
92 if (len == 0) 92 if (len == 0)
93 return EXIT_SUCCESS; 93 return EXIT_SUCCESS;
94 94
diff --git a/util-linux/eject.c b/util-linux/eject.c
index 749e2c986..3ccb4ae89 100644
--- a/util-linux/eject.c
+++ b/util-linux/eject.c
@@ -70,7 +70,7 @@ static void eject_scsi(const char *dev)
70 sg_io_hdr_t io_hdr; 70 sg_io_hdr_t io_hdr;
71 71
72 if ((ioctl(dev_fd, SG_GET_VERSION_NUM, &i) < 0) || (i < 30000)) 72 if ((ioctl(dev_fd, SG_GET_VERSION_NUM, &i) < 0) || (i < 30000))
73 bb_error_msg_and_die("not a sg device or old sg driver"); 73 bb_simple_error_msg_and_die("not a sg device or old sg driver");
74 74
75 memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); 75 memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
76 io_hdr.interface_id = 'S'; 76 io_hdr.interface_id = 'S';
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index ff3bc4870..e1c8561d6 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -117,7 +117,7 @@ int fdformat_main(int argc UNUSED_PARAM, char **argv)
117 read_bytes = safe_read(fd, data, n); 117 read_bytes = safe_read(fd, data, n);
118 if (read_bytes != n) { 118 if (read_bytes != n) {
119 if (read_bytes < 0) { 119 if (read_bytes < 0) {
120 bb_perror_msg(bb_msg_read_error); 120 bb_simple_perror_msg(bb_msg_read_error);
121 } 121 }
122 bb_error_msg_and_die("problem reading cylinder %d, " 122 bb_error_msg_and_die("problem reading cylinder %d, "
123 "expected %d, read %d", cyl, n, read_bytes); 123 "expected %d, read %d", cyl, n, read_bytes);
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 58e93bb92..f28d4fdd2 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -511,7 +511,7 @@ static sector_t bb_BLKGETSIZE_sectors(int fd)
511 * we support can't record more than 32 bit 511 * we support can't record more than 32 bit
512 * sector counts or offsets 512 * sector counts or offsets
513 */ 513 */
514 bb_error_msg("device has more than 2^32 sectors, can't use all of them"); 514 bb_simple_error_msg("device has more than 2^32 sectors, can't use all of them");
515 v64 = (uint32_t)-1L; 515 v64 = (uint32_t)-1L;
516 } 516 }
517 return v64; 517 return v64;
diff --git a/util-linux/flock.c b/util-linux/flock.c
index 130627e93..12c16013c 100644
--- a/util-linux/flock.c
+++ b/util-linux/flock.c
@@ -73,7 +73,7 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
73 ) { 73 ) {
74 argv++; 74 argv++;
75 if (argv[1]) 75 if (argv[1])
76 bb_error_msg_and_die("-c takes only one argument"); 76 bb_simple_error_msg_and_die("-c takes only one argument");
77 opt |= OPT_c; 77 opt |= OPT_c;
78 } 78 }
79 79
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index f523da945..40b86d01b 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -321,7 +321,7 @@ static void die(const char *str)
321{ 321{
322 if (termios_set) 322 if (termios_set)
323 tcsetattr_stdin_TCSANOW(&sv_termios); 323 tcsetattr_stdin_TCSANOW(&sv_termios);
324 bb_error_msg_and_die("%s", str); 324 bb_simple_error_msg_and_die(str);
325} 325}
326 326
327static void push_filename(const char *name) 327static void push_filename(const char *name)
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 1666d3d30..db7db6ff8 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -308,7 +308,7 @@ static struct option *add_long_options(struct option *long_options, char *option
308 } 308 }
309 tokptr[tlen] = '\0'; 309 tokptr[tlen] = '\0';
310 if (tlen == 0) 310 if (tlen == 0)
311 bb_error_msg_and_die("empty long option specified"); 311 bb_simple_error_msg_and_die("empty long option specified");
312 } 312 }
313 long_options = xrealloc_vector(long_options, 4, long_nr); 313 long_options = xrealloc_vector(long_options, 4, long_nr);
314 long_options[long_nr].has_arg = arg_opt; 314 long_options[long_nr].has_arg = arg_opt;
@@ -380,7 +380,7 @@ int getopt_main(int argc, char **argv)
380 puts(" --"); 380 puts(" --");
381 return 0; 381 return 0;
382 } 382 }
383 bb_error_msg_and_die("missing optstring argument"); 383 bb_simple_error_msg_and_die("missing optstring argument");
384 } 384 }
385 385
386 if (argv[1][0] != '-' || compatible) { 386 if (argv[1][0] != '-' || compatible) {
@@ -416,7 +416,7 @@ int getopt_main(int argc, char **argv)
416 if (!optstr) { 416 if (!optstr) {
417 optstr = argv[++n]; 417 optstr = argv[++n];
418 if (!optstr) 418 if (!optstr)
419 bb_error_msg_and_die("missing optstring argument"); 419 bb_simple_error_msg_and_die("missing optstring argument");
420 } 420 }
421 421
422 argv[n] = name ? name : argv[0]; 422 argv[n] = name ? name : argv[0];
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 29f51021e..dc97d8fb4 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -132,7 +132,7 @@ static void to_sys_clock(const char **pp_rtcname, int utc)
132 tv.tv_sec = read_rtc(pp_rtcname, NULL, utc); 132 tv.tv_sec = read_rtc(pp_rtcname, NULL, utc);
133 tv.tv_usec = 0; 133 tv.tv_usec = 0;
134 if (settimeofday(&tv, &tz)) 134 if (settimeofday(&tv, &tz))
135 bb_perror_msg_and_die("settimeofday"); 135 bb_simple_perror_msg_and_die("settimeofday");
136} 136}
137 137
138static void from_sys_clock(const char **pp_rtcname, int utc) 138static void from_sys_clock(const char **pp_rtcname, int utc)
@@ -284,7 +284,7 @@ static void set_system_clock_timezone(int utc)
284 if (!utc) 284 if (!utc)
285 tv.tv_sec += tz.tz_minuteswest * 60; 285 tv.tv_sec += tz.tz_minuteswest * 60;
286 if (settimeofday(&tv, &tz)) 286 if (settimeofday(&tv, &tz))
287 bb_perror_msg_and_die("settimeofday"); 287 bb_simple_perror_msg_and_die("settimeofday");
288} 288}
289 289
290//usage:#define hwclock_trivial_usage 290//usage:#define hwclock_trivial_usage
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c
index 4863a5c29..df86cfb9d 100644
--- a/util-linux/ipcs.c
+++ b/util-linux/ipcs.c
@@ -467,7 +467,7 @@ static void print_shm(int shmid)
467 struct ipc_perm *ipcp = &shmds.shm_perm; 467 struct ipc_perm *ipcp = &shmds.shm_perm;
468 468
469 if (shmctl(shmid, IPC_STAT, &shmds) == -1) { 469 if (shmctl(shmid, IPC_STAT, &shmds) == -1) {
470 bb_perror_msg("shmctl"); 470 bb_simple_perror_msg("shmctl");
471 return; 471 return;
472 } 472 }
473 473
@@ -493,7 +493,7 @@ static void print_msg(int msqid)
493 struct ipc_perm *ipcp = &buf.msg_perm; 493 struct ipc_perm *ipcp = &buf.msg_perm;
494 494
495 if (msgctl(msqid, IPC_STAT, &buf) == -1) { 495 if (msgctl(msqid, IPC_STAT, &buf) == -1) {
496 bb_perror_msg("msgctl"); 496 bb_simple_perror_msg("msgctl");
497 return; 497 return;
498 } 498 }
499 499
@@ -527,7 +527,7 @@ static void print_sem(int semid)
527 527
528 arg.buf = &semds; 528 arg.buf = &semds;
529 if (semctl(semid, 0, IPC_STAT, arg)) { 529 if (semctl(semid, 0, IPC_STAT, arg)) {
530 bb_perror_msg("semctl"); 530 bb_simple_perror_msg("semctl");
531 return; 531 return;
532 } 532 }
533 533
@@ -555,7 +555,7 @@ static void print_sem(int semid)
555 zcnt = semctl(semid, i, GETZCNT, arg); 555 zcnt = semctl(semid, i, GETZCNT, arg);
556 pid = semctl(semid, i, GETPID, arg); 556 pid = semctl(semid, i, GETPID, arg);
557 if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) { 557 if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) {
558 bb_perror_msg_and_die("semctl"); 558 bb_simple_perror_msg_and_die("semctl");
559 } 559 }
560 printf("%-10u %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); 560 printf("%-10u %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
561 } 561 }
diff --git a/util-linux/last.c b/util-linux/last.c
index 689aa7a34..24ce7a8d8 100644
--- a/util-linux/last.c
+++ b/util-linux/last.c
@@ -100,7 +100,7 @@ int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
100 pos = lseek(file, pos - sizeof(ut), SEEK_SET); 100 pos = lseek(file, pos - sizeof(ut), SEEK_SET);
101 while ((n = full_read(file, &ut, sizeof(ut))) > 0) { 101 while ((n = full_read(file, &ut, sizeof(ut))) > 0) {
102 if (n != sizeof(ut)) { 102 if (n != sizeof(ut)) {
103 bb_perror_msg_and_die("short read"); 103 bb_simple_perror_msg_and_die("short read");
104 } 104 }
105 n = index_in_strings(_ut_lin, ut.ut_line); 105 n = index_in_strings(_ut_lin, ut.ut_line);
106 if (n == _TILDE) { /* '~' */ 106 if (n == _TILDE) { /* '~' */
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index 5dc757074..cc6c2b1d5 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -118,13 +118,13 @@ int losetup_main(int argc UNUSED_PARAM, char **argv)
118 118
119 n = get_free_loop(); 119 n = get_free_loop();
120 if (n == -1) 120 if (n == -1)
121 bb_error_msg_and_die("no free loop devices"); 121 bb_simple_error_msg_and_die("no free loop devices");
122 if (n < 0) /* n == -2: no /dev/loop-control, use legacy method */ 122 if (n < 0) /* n == -2: no /dev/loop-control, use legacy method */
123 n = 0; 123 n = 0;
124 /* or: n >= 0: the number of next free loopdev, just verify it */ 124 /* or: n >= 0: the number of next free loopdev, just verify it */
125 do { 125 do {
126 if (n > MAX_LOOP_NUM) 126 if (n > MAX_LOOP_NUM)
127 bb_error_msg_and_die("no free loop devices"); 127 bb_simple_error_msg_and_die("no free loop devices");
128 sprintf(dev, LOOP_FORMAT, n++); 128 sprintf(dev, LOOP_FORMAT, n++);
129 s = query_loop(dev); 129 s = query_loop(dev);
130 free(s); 130 free(s);
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 9cb3586f1..207a112c1 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -250,18 +250,24 @@
250 250
251#if DEBUG_LVL >= 1 251#if DEBUG_LVL >= 1
252# define dbg1(...) do { if (G.verbose) bb_error_msg(__VA_ARGS__); } while(0) 252# define dbg1(...) do { if (G.verbose) bb_error_msg(__VA_ARGS__); } while(0)
253# define dbg1s(msg) do { if (G.verbose) bb_simple_error_msg(msg); } while(0)
253#else 254#else
254# define dbg1(...) ((void)0) 255# define dbg1(...) ((void)0)
256# define dbg1s(msg) ((void)0)
255#endif 257#endif
256#if DEBUG_LVL >= 2 258#if DEBUG_LVL >= 2
257# define dbg2(...) do { if (G.verbose >= 2) bb_error_msg(__VA_ARGS__); } while(0) 259# define dbg2(...) do { if (G.verbose >= 2) bb_error_msg(__VA_ARGS__); } while(0)
260# define dbg2s(msg) do { if (G.verbose >= 2) bb_simple_error_msg(msg); } while(0)
258#else 261#else
259# define dbg2(...) ((void)0) 262# define dbg2(...) ((void)0)
263# define dbg2s(msg) ((void)0)
260#endif 264#endif
261#if DEBUG_LVL >= 3 265#if DEBUG_LVL >= 3
262# define dbg3(...) do { if (G.verbose >= 3) bb_error_msg(__VA_ARGS__); } while(0) 266# define dbg3(...) do { if (G.verbose >= 3) bb_error_msg(__VA_ARGS__); } while(0)
267# define dbg3s(msg) do { if (G.verbose >= 3) bb_simple_error_msg(msg); } while(0)
263#else 268#else
264# define dbg3(...) ((void)0) 269# define dbg3(...) ((void)0)
270# define dbg3s(msg) ((void)0)
265#endif 271#endif
266 272
267 273
@@ -1021,7 +1027,7 @@ wait_for_seqfile(unsigned expected_seq)
1021 /* seed file: write out seq ASAP */ 1027 /* seed file: write out seq ASAP */
1022 xwrite_str(seq_fd, utoa(expected_seq)); 1028 xwrite_str(seq_fd, utoa(expected_seq));
1023 xlseek(seq_fd, 0, SEEK_SET); 1029 xlseek(seq_fd, 0, SEEK_SET);
1024 dbg2("first seq written"); 1030 dbg2s("first seq written");
1025 break; 1031 break;
1026 } 1032 }
1027 seqbufnum = atoll(seqbuf); 1033 seqbufnum = atoll(seqbuf);
@@ -1165,7 +1171,7 @@ static void daemon_loop(char *temp, int fd)
1165 1171
1166 len = safe_read(fd, netbuf, sizeof(netbuf) - 1); 1172 len = safe_read(fd, netbuf, sizeof(netbuf) - 1);
1167 if (len < 0) { 1173 if (len < 0) {
1168 bb_perror_msg_and_die("read"); 1174 bb_simple_perror_msg_and_die("read");
1169 } 1175 }
1170 end = netbuf + len; 1176 end = netbuf + len;
1171 *end = '\0'; 1177 *end = '\0';
diff --git a/util-linux/mesg.c b/util-linux/mesg.c
index c7b696853..8c032555b 100644
--- a/util-linux/mesg.c
+++ b/util-linux/mesg.c
@@ -65,7 +65,7 @@ int mesg_main(int argc UNUSED_PARAM, char **argv)
65 */ 65 */
66 66
67 if (!isatty(STDIN_FILENO)) 67 if (!isatty(STDIN_FILENO))
68 bb_error_msg_and_die("not a tty"); 68 bb_simple_error_msg_and_die("not a tty");
69 69
70 xfstat(STDIN_FILENO, &sb, "stdin"); 70 xfstat(STDIN_FILENO, &sb, "stdin");
71 if (c == 0) { 71 if (c == 0) {
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index 845ba0a24..d568f4be5 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -266,7 +266,7 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
266 // N.B. what if we format a file? find_mount_point will return false negative since 266 // N.B. what if we format a file? find_mount_point will return false negative since
267 // it is loop block device which is mounted! 267 // it is loop block device which is mounted!
268 if (find_mount_point(argv[0], 0)) 268 if (find_mount_point(argv[0], 0))
269 bb_error_msg_and_die("can't format mounted filesystem"); 269 bb_simple_error_msg_and_die("can't format mounted filesystem");
270 270
271 // get size in kbytes 271 // get size in kbytes
272 kilobytes = get_volume_size_in_bytes(fd, argv[1], 1024, /*extend:*/ !(option_mask32 & OPT_n)) / 1024; 272 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)
326 kilobytes >>= (blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE); 326 kilobytes >>= (blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE);
327 nblocks = kilobytes; 327 nblocks = kilobytes;
328 if (nblocks != kilobytes) 328 if (nblocks != kilobytes)
329 bb_error_msg_and_die("block count doesn't fit in 32 bits"); 329 bb_simple_error_msg_and_die("block count doesn't fit in 32 bits");
330#define kilobytes kilobytes_unused_after_this 330#define kilobytes kilobytes_unused_after_this
331 // Experimentally, standard mke2fs won't work on images smaller than 60k 331 // Experimentally, standard mke2fs won't work on images smaller than 60k
332 if (nblocks < 60) 332 if (nblocks < 60)
333 bb_error_msg_and_die("need >= 60 blocks"); 333 bb_simple_error_msg_and_die("need >= 60 blocks");
334 334
335 // How many reserved blocks? 335 // How many reserved blocks?
336 if (reserved_percent > 50) 336 if (reserved_percent > 50)
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index e191acbd0..8f791cf66 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -262,7 +262,7 @@ static int get_free_block(void)
262 int blk; 262 int blk;
263 263
264 if (G.used_good_blocks + 1 >= MAX_GOOD_BLOCKS) 264 if (G.used_good_blocks + 1 >= MAX_GOOD_BLOCKS)
265 bb_error_msg_and_die("too many bad blocks"); 265 bb_simple_error_msg_and_die("too many bad blocks");
266 if (G.used_good_blocks) 266 if (G.used_good_blocks)
267 blk = G.good_blocks_table[G.used_good_blocks - 1] + 1; 267 blk = G.good_blocks_table[G.used_good_blocks - 1] + 1;
268 else 268 else
@@ -270,7 +270,7 @@ static int get_free_block(void)
270 while (blk < SB_ZONES && zone_in_use(blk)) 270 while (blk < SB_ZONES && zone_in_use(blk))
271 blk++; 271 blk++;
272 if (blk >= SB_ZONES) 272 if (blk >= SB_ZONES)
273 bb_error_msg_and_die("not enough good blocks"); 273 bb_simple_error_msg_and_die("not enough good blocks");
274 G.good_blocks_table[G.used_good_blocks] = blk; 274 G.good_blocks_table[G.used_good_blocks] = blk;
275 G.used_good_blocks++; 275 G.used_good_blocks++;
276 return blk; 276 return blk;
@@ -342,7 +342,7 @@ static void make_bad_inode(void)
342 goto end_bad; 342 goto end_bad;
343 } 343 }
344 } 344 }
345 bb_error_msg_and_die("too many bad blocks"); 345 bb_simple_error_msg_and_die("too many bad blocks");
346 end_bad: 346 end_bad:
347 if (ind) 347 if (ind)
348 write_block(ind, (char *) ind_block); 348 write_block(ind, (char *) ind_block);
@@ -398,7 +398,7 @@ static void make_bad_inode2(void)
398 } 398 }
399 } 399 }
400 /* Could make triple indirect block here */ 400 /* Could make triple indirect block here */
401 bb_error_msg_and_die("too many bad blocks"); 401 bb_simple_error_msg_and_die("too many bad blocks");
402 end_bad: 402 end_bad:
403 if (ind) 403 if (ind)
404 write_block(ind, (char *) ind_block); 404 write_block(ind, (char *) ind_block);
@@ -514,7 +514,7 @@ static void check_blocks(void)
514 if (got == try) 514 if (got == try)
515 continue; 515 continue;
516 if (G.currently_testing < SB_FIRSTZONE) 516 if (G.currently_testing < SB_FIRSTZONE)
517 bb_error_msg_and_die("bad blocks before data-area: cannot make fs"); 517 bb_simple_error_msg_and_die("bad blocks before data-area: cannot make fs");
518 mark_zone(G.currently_testing); 518 mark_zone(G.currently_testing);
519 G.badblocks++; 519 G.badblocks++;
520 G.currently_testing++; 520 G.currently_testing++;
@@ -588,7 +588,7 @@ static void setup_tables(void)
588 SB_ZMAPS = sb_zmaps; 588 SB_ZMAPS = sb_zmaps;
589 /* new SB_ZMAPS, need to recalc NORM_FIRSTZONE */ 589 /* new SB_ZMAPS, need to recalc NORM_FIRSTZONE */
590 } while (--i); 590 } while (--i);
591 bb_error_msg_and_die("incompatible size/inode count, try different -i N"); 591 bb_simple_error_msg_and_die("incompatible size/inode count, try different -i N");
592 got_it: 592 got_it:
593 593
594 SB_FIRSTZONE = norm_firstzone; 594 SB_FIRSTZONE = norm_firstzone;
@@ -623,10 +623,10 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
623 G.magic = MINIX1_SUPER_MAGIC2; 623 G.magic = MINIX1_SUPER_MAGIC2;
624 624
625 if (INODE_SIZE1 * MINIX1_INODES_PER_BLOCK != BLOCK_SIZE) 625 if (INODE_SIZE1 * MINIX1_INODES_PER_BLOCK != BLOCK_SIZE)
626 bb_error_msg_and_die("bad inode size"); 626 bb_simple_error_msg_and_die("bad inode size");
627#if ENABLE_FEATURE_MINIX2 627#if ENABLE_FEATURE_MINIX2
628 if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) 628 if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
629 bb_error_msg_and_die("bad inode size"); 629 bb_simple_error_msg_and_die("bad inode size");
630#endif 630#endif
631 631
632 opt = getopt32(argv, "ci:l:n:+v", &str_i, &listfile, &G.namelen); 632 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)
644#if ENABLE_FEATURE_MINIX2 644#if ENABLE_FEATURE_MINIX2
645 version2 = 1; 645 version2 = 1;
646#else 646#else
647 bb_error_msg_and_die("not compiled with minix v2 support"); 647 bb_simple_error_msg_and_die("not compiled with minix v2 support");
648#endif 648#endif
649 } 649 }
650 650
@@ -654,14 +654,14 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
654 654
655 /* Check if it is mounted */ 655 /* Check if it is mounted */
656 if (find_mount_point(G.device_name, 0)) 656 if (find_mount_point(G.device_name, 0))
657 bb_error_msg_and_die("can't format mounted filesystem"); 657 bb_simple_error_msg_and_die("can't format mounted filesystem");
658 658
659 xmove_fd(xopen(G.device_name, O_RDWR), dev_fd); 659 xmove_fd(xopen(G.device_name, O_RDWR), dev_fd);
660 660
661 G.total_blocks = get_volume_size_in_bytes(dev_fd, argv[1], 1024, /*extend:*/ 1) / 1024; 661 G.total_blocks = get_volume_size_in_bytes(dev_fd, argv[1], 1024, /*extend:*/ 1) / 1024;
662 662
663 if (G.total_blocks < 10) 663 if (G.total_blocks < 10)
664 bb_error_msg_and_die("must have at least 10 blocks"); 664 bb_simple_error_msg_and_die("must have at least 10 blocks");
665 665
666 if (version2) { 666 if (version2) {
667 G.magic = MINIX2_SUPER_MAGIC2; 667 G.magic = MINIX2_SUPER_MAGIC2;
diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c
index b4c8dda6f..d2eaf5f94 100644
--- a/util-linux/mkfs_reiser.c
+++ b/util-linux/mkfs_reiser.c
@@ -178,7 +178,7 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv)
178 // N.B. what if we format a file? find_mount_point will return false negative since 178 // N.B. what if we format a file? find_mount_point will return false negative since
179 // it is loop block device which is mounted! 179 // it is loop block device which is mounted!
180 if (find_mount_point(argv[0], 0)) 180 if (find_mount_point(argv[0], 0))
181 bb_error_msg_and_die("can't format mounted filesystem"); 181 bb_simple_error_msg_and_die("can't format mounted filesystem");
182 182
183 // open the device, get size in blocks 183 // open the device, get size in blocks
184 blocks = get_volume_size_in_bytes(fd, argv[1], blocksize, /*extend:*/ 1) / blocksize; 184 blocks = get_volume_size_in_bytes(fd, argv[1], blocksize, /*extend:*/ 1) / blocksize;
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index b760fb2aa..16c1fac00 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -278,7 +278,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
278 if (!S_ISBLK(st.st_mode)) { 278 if (!S_ISBLK(st.st_mode)) {
279 if (!S_ISREG(st.st_mode)) { 279 if (!S_ISREG(st.st_mode)) {
280 if (!argv[1]) 280 if (!argv[1])
281 bb_error_msg_and_die("image size must be specified"); 281 bb_simple_error_msg_and_die("image size must be specified");
282 } 282 }
283 // not a block device, skip bad sectors check 283 // not a block device, skip bad sectors check
284 opts &= ~OPT_c; 284 opts &= ~OPT_c;
@@ -399,7 +399,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
399 // "mkdosfs -v -F 32 image5k 5" is the minimum: 399 // "mkdosfs -v -F 32 image5k 5" is the minimum:
400 // 2 sectors for FATs and 2 data sectors 400 // 2 sectors for FATs and 2 data sectors
401 if ((off_t)(volume_size_sect - reserved_sect) < 4) 401 if ((off_t)(volume_size_sect - reserved_sect) < 4)
402 bb_error_msg_and_die("the image is too small for FAT32"); 402 bb_simple_error_msg_and_die("the image is too small for FAT32");
403 sect_per_fat = 1; 403 sect_per_fat = 1;
404 while (1) { 404 while (1) {
405 while (1) { 405 while (1) {
@@ -439,7 +439,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
439 } 439 }
440 next: 440 next:
441 if (sect_per_clust == 128) 441 if (sect_per_clust == 128)
442 bb_error_msg_and_die("can't make FAT32 with >128 sectors/cluster"); 442 bb_simple_error_msg_and_die("can't make FAT32 with >128 sectors/cluster");
443 sect_per_clust *= 2; 443 sect_per_clust *= 2;
444 sect_per_fat = (sect_per_fat / 2) | 1; 444 sect_per_fat = (sect_per_fat / 2) | 1;
445 } 445 }
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 38413606d..9e51a1dcc 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -75,7 +75,7 @@ static void mkswap_selinux_setcontext(int fd, const char *path)
75 } 75 }
76 return; 76 return;
77 error: 77 error:
78 bb_perror_msg_and_die("SELinux relabeling failed"); 78 bb_simple_perror_msg_and_die("SELinux relabeling failed");
79} 79}
80#else 80#else
81# define mkswap_selinux_setcontext(fd, path) ((void)0) 81# define mkswap_selinux_setcontext(fd, path) ((void)0)
diff --git a/util-linux/mount.c b/util-linux/mount.c
index e6bad7c2c..84c85c057 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -483,7 +483,7 @@ static void FAST_FUNC update_mtab_entry_on_move(const struct mntent *mp)
483 483
484 mountTable = setmntent(bb_path_mtab_file, "r"); 484 mountTable = setmntent(bb_path_mtab_file, "r");
485 if (!mountTable) { 485 if (!mountTable) {
486 bb_perror_msg(bb_path_mtab_file); 486 bb_simple_perror_msg(bb_path_mtab_file);
487 return; 487 return;
488 } 488 }
489 489
@@ -511,7 +511,7 @@ static void FAST_FUNC update_mtab_entry_on_move(const struct mntent *mp)
511 } 511 }
512 endmntent(mountTable); 512 endmntent(mountTable);
513 } else if (errno != EROFS) 513 } else if (errno != EROFS)
514 bb_perror_msg(bb_path_mtab_file); 514 bb_simple_perror_msg(bb_path_mtab_file);
515 515
516 if (ENABLE_FEATURE_CLEAN_UP) { 516 if (ENABLE_FEATURE_CLEAN_UP) {
517 for (i = 0; i < count; i++) { 517 for (i = 0; i < count; i++) {
@@ -739,7 +739,7 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero
739 // Abort entirely if permission denied. 739 // Abort entirely if permission denied.
740 740
741 if (rc && errno == EPERM) 741 if (rc && errno == EPERM)
742 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 742 bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
743 743
744 // If the mount was successful, and we're maintaining an old-style 744 // If the mount was successful, and we're maintaining an old-style
745 // mtab file by hand, add the new entry to it now. 745 // 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
751 int i; 751 int i;
752 752
753 if (!mountTable) { 753 if (!mountTable) {
754 bb_perror_msg(bb_path_mtab_file); 754 bb_simple_perror_msg(bb_path_mtab_file);
755 goto ret; 755 goto ret;
756 } 756 }
757 757
@@ -1288,18 +1288,18 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1288 s = strchr(hostname, ','); 1288 s = strchr(hostname, ',');
1289 if (s) { 1289 if (s) {
1290 *s = '\0'; 1290 *s = '\0';
1291 bb_error_msg("warning: multiple hostnames not supported"); 1291 bb_simple_error_msg("warning: multiple hostnames not supported");
1292 } 1292 }
1293 1293
1294 server_addr.sin_family = AF_INET; 1294 server_addr.sin_family = AF_INET;
1295 if (!inet_aton(hostname, &server_addr.sin_addr)) { 1295 if (!inet_aton(hostname, &server_addr.sin_addr)) {
1296 hp = gethostbyname(hostname); 1296 hp = gethostbyname(hostname);
1297 if (hp == NULL) { 1297 if (hp == NULL) {
1298 bb_herror_msg("%s", hostname); 1298 bb_simple_herror_msg(hostname);
1299 goto fail; 1299 goto fail;
1300 } 1300 }
1301 if (hp->h_length != (int)sizeof(struct in_addr)) { 1301 if (hp->h_length != (int)sizeof(struct in_addr)) {
1302 bb_error_msg_and_die("only IPv4 is supported"); 1302 bb_simple_error_msg_and_die("only IPv4 is supported");
1303 } 1303 }
1304 memcpy(&server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr)); 1304 memcpy(&server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
1305 } 1305 }
@@ -1389,7 +1389,7 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1389 else if (is_prefixed_with(opteq, "udp")) 1389 else if (is_prefixed_with(opteq, "udp"))
1390 tcp = 0; 1390 tcp = 0;
1391 else 1391 else
1392 bb_error_msg("warning: unrecognized proto= option"); 1392 bb_simple_error_msg("warning: unrecognized proto= option");
1393 continue; 1393 continue;
1394 case 20: // "addr" - ignore 1394 case 20: // "addr" - ignore
1395 continue; 1395 continue;
@@ -1522,7 +1522,7 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1522 if (nfs_mount_version >= 3) 1522 if (nfs_mount_version >= 3)
1523 nolock = !val; 1523 nolock = !val;
1524 else 1524 else
1525 bb_error_msg("warning: option nolock is not supported"); 1525 bb_simple_error_msg("warning: option nolock is not supported");
1526 break; 1526 break;
1527 case 11: //rdirplus 1527 case 11: //rdirplus
1528 nordirplus = !val; 1528 nordirplus = !val;
@@ -1590,11 +1590,11 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1590 } else { 1590 } else {
1591 hp = gethostbyname(mounthost); 1591 hp = gethostbyname(mounthost);
1592 if (hp == NULL) { 1592 if (hp == NULL) {
1593 bb_herror_msg("%s", mounthost); 1593 bb_simple_herror_msg(mounthost);
1594 goto fail; 1594 goto fail;
1595 } 1595 }
1596 if (hp->h_length != (int)sizeof(struct in_addr)) { 1596 if (hp->h_length != (int)sizeof(struct in_addr)) {
1597 bb_error_msg_and_die("only IPv4 is supported"); 1597 bb_simple_error_msg_and_die("only IPv4 is supported");
1598 } 1598 }
1599 mount_server_addr.sin_family = AF_INET; 1599 mount_server_addr.sin_family = AF_INET;
1600 memcpy(&mount_server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr)); 1600 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
1767 /* Create nfs socket for kernel */ 1767 /* Create nfs socket for kernel */
1768 if (tcp) { 1768 if (tcp) {
1769 if (nfs_mount_version < 3) { 1769 if (nfs_mount_version < 3) {
1770 bb_error_msg("NFS over TCP is not supported"); 1770 bb_simple_error_msg("NFS over TCP is not supported");
1771 goto fail; 1771 goto fail;
1772 } 1772 }
1773 fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); 1773 fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
1774 } else 1774 } else
1775 fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); 1775 fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
1776 if (fsock < 0) { 1776 if (fsock < 0) {
1777 bb_perror_msg("nfs socket"); 1777 bb_simple_perror_msg("nfs socket");
1778 goto fail; 1778 goto fail;
1779 } 1779 }
1780 if (bindresvport(fsock, 0) < 0) { 1780 if (bindresvport(fsock, 0) < 0) {
1781 bb_perror_msg("nfs bindresvport"); 1781 bb_simple_perror_msg("nfs bindresvport");
1782 goto fail; 1782 goto fail;
1783 } 1783 }
1784 if (port == 0) { 1784 if (port == 0) {
@@ -2047,9 +2047,9 @@ static int singlemount(struct mntent *mp, int ignore_busy)
2047 ); 2047 );
2048 if (loopfd < 0) { 2048 if (loopfd < 0) {
2049 if (errno == EPERM || errno == EACCES) 2049 if (errno == EPERM || errno == EACCES)
2050 bb_error_msg(bb_msg_perm_denied_are_you_root); 2050 bb_simple_error_msg(bb_msg_perm_denied_are_you_root);
2051 else 2051 else
2052 bb_perror_msg("can't setup loop device"); 2052 bb_simple_perror_msg("can't setup loop device");
2053 return errno; 2053 return errno;
2054 } 2054 }
2055 2055
@@ -2255,7 +2255,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
2255 // argument when we get it. 2255 // argument when we get it.
2256 if (argv[1]) { 2256 if (argv[1]) {
2257 if (nonroot) 2257 if (nonroot)
2258 bb_error_msg_and_die(bb_msg_you_must_be_root); 2258 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
2259 mtpair->mnt_fsname = argv[0]; 2259 mtpair->mnt_fsname = argv[0];
2260 mtpair->mnt_dir = argv[1]; 2260 mtpair->mnt_dir = argv[1];
2261 mtpair->mnt_type = fstype; 2261 mtpair->mnt_type = fstype;
@@ -2272,7 +2272,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
2272 2272
2273 cmdopt_flags = parse_mount_options(cmdopts, NULL); 2273 cmdopt_flags = parse_mount_options(cmdopts, NULL);
2274 if (nonroot && (cmdopt_flags & ~MS_SILENT)) // Non-root users cannot specify flags 2274 if (nonroot && (cmdopt_flags & ~MS_SILENT)) // Non-root users cannot specify flags
2275 bb_error_msg_and_die(bb_msg_you_must_be_root); 2275 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
2276 2276
2277 // If we have a shared subtree flag, don't worry about fstab or mtab. 2277 // If we have a shared subtree flag, don't worry about fstab or mtab.
2278 if (ENABLE_FEATURE_MOUNT_FLAGS 2278 if (ENABLE_FEATURE_MOUNT_FLAGS
@@ -2337,7 +2337,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
2337 // No, mount -a won't mount anything, 2337 // No, mount -a won't mount anything,
2338 // even user mounts, for mere humans 2338 // even user mounts, for mere humans
2339 if (nonroot) 2339 if (nonroot)
2340 bb_error_msg_and_die(bb_msg_you_must_be_root); 2340 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
2341 2341
2342 // Does type match? (NULL matches always) 2342 // Does type match? (NULL matches always)
2343 if (!fstype_matches(mtcur->mnt_type, fstype)) 2343 if (!fstype_matches(mtcur->mnt_type, fstype))
@@ -2417,7 +2417,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
2417 // fstab must have "users" or "user" 2417 // fstab must have "users" or "user"
2418 l = parse_mount_options(mtcur->mnt_opts, NULL); 2418 l = parse_mount_options(mtcur->mnt_opts, NULL);
2419 if (!(l & MOUNT_USERS)) 2419 if (!(l & MOUNT_USERS))
2420 bb_error_msg_and_die(bb_msg_you_must_be_root); 2420 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
2421 } 2421 }
2422 2422
2423 //util-linux-2.12 does not do this check. 2423 //util-linux-2.12 does not do this check.
diff --git a/util-linux/nsenter.c b/util-linux/nsenter.c
index 4eeaa9f3e..304f2d748 100644
--- a/util-linux/nsenter.c
+++ b/util-linux/nsenter.c
@@ -257,7 +257,7 @@ int nsenter_main(int argc UNUSED_PARAM, char **argv)
257 257
258 if (opts & OPT_setgid) { 258 if (opts & OPT_setgid) {
259 if (setgroups(0, NULL) < 0 && setgroups_failed) 259 if (setgroups(0, NULL) < 0 && setgroups_failed)
260 bb_perror_msg_and_die("setgroups"); 260 bb_simple_perror_msg_and_die("setgroups");
261 xsetgid(gid); 261 xsetgid(gid);
262 } 262 }
263 if (opts & OPT_setuid) 263 if (opts & OPT_setuid)
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 70f829e7f..41aade5ea 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -33,7 +33,7 @@ enum { RFC_868_BIAS = 2208988800UL };
33 33
34static void socket_timeout(int sig UNUSED_PARAM) 34static void socket_timeout(int sig UNUSED_PARAM)
35{ 35{
36 bb_error_msg_and_die("timeout connecting to time server"); 36 bb_simple_error_msg_and_die("timeout connecting to time server");
37} 37}
38 38
39static time_t askremotedate(const char *host) 39static time_t askremotedate(const char *host)
@@ -94,10 +94,10 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
94 94
95 if (!(flags & 2)) { /* no -p (-s may be present) */ 95 if (!(flags & 2)) { /* no -p (-s may be present) */
96 if (time(NULL) == remote_time) 96 if (time(NULL) == remote_time)
97 bb_error_msg("current time matches remote time"); 97 bb_simple_error_msg("current time matches remote time");
98 else 98 else
99 if (stime(&remote_time) < 0) 99 if (stime(&remote_time) < 0)
100 bb_perror_msg_and_die("can't set time of day"); 100 bb_simple_perror_msg_and_die("can't set time of day");
101 } 101 }
102 102
103 if (flags != 1) /* not lone -s */ 103 if (flags != 1) /* not lone -s */
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index cab2c4319..c4ea374be 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -142,7 +142,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
142 small++; 142 small++;
143 } 143 }
144 if (big > small) { 144 if (big > small) {
145 bb_error_msg("assuming reversed byte order, " 145 bb_simple_error_msg("assuming reversed byte order, "
146 "use -n to force native byte order"); 146 "use -n to force native byte order");
147 BUILD_BUG_ON(sizeof(*p) > 8); 147 BUILD_BUG_ON(sizeof(*p) > 8);
148 for (p = buf; p < buf+len; p++) { 148 for (p = buf; p < buf+len; p++) {
@@ -204,7 +204,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
204 } 204 }
205 205
206 if (indx >= len) 206 if (indx >= len)
207 bb_error_msg_and_die("profile address out of range. " 207 bb_simple_error_msg_and_die("profile address out of range. "
208 "Wrong map file?"); 208 "Wrong map file?");
209 209
210 this = 0; 210 this = 0;
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index 29c440b82..cad0f9d64 100644
--- a/util-linux/rtcwake.c
+++ b/util-linux/rtcwake.c
@@ -230,7 +230,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv)
230 do { 230 do {
231 ssize_t ret = safe_read(fd, &data, sizeof(data)); 231 ssize_t ret = safe_read(fd, &data, sizeof(data));
232 if (ret < 0) { 232 if (ret < 0) {
233 bb_perror_msg("rtc read"); 233 bb_simple_perror_msg("rtc read");
234 break; 234 break;
235 } 235 }
236 } while (!(data & RTC_AF)); 236 } while (!(data & RTC_AF));
diff --git a/util-linux/setpriv.c b/util-linux/setpriv.c
index b69b8cbb6..e5cf96957 100644
--- a/util-linux/setpriv.c
+++ b/util-linux/setpriv.c
@@ -164,7 +164,7 @@ static void set_inh_caps(char *capstring)
164 } 164 }
165 165
166 if (capset(&caps.header, caps.data) != 0) 166 if (capset(&caps.header, caps.data) != 0)
167 bb_perror_msg_and_die("capset"); 167 bb_simple_perror_msg_and_die("capset");
168} 168}
169 169
170static void set_ambient_caps(char *string) 170static void set_ambient_caps(char *string)
@@ -178,10 +178,10 @@ static void set_ambient_caps(char *string)
178 idx = parse_cap(cap); 178 idx = parse_cap(cap);
179 if (cap[0] == '+') { 179 if (cap[0] == '+') {
180 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, idx, 0, 0) < 0) 180 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, idx, 0, 0) < 0)
181 bb_perror_msg("cap_ambient_raise"); 181 bb_simple_perror_msg("cap_ambient_raise");
182 } else { 182 } else {
183 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, idx, 0, 0) < 0) 183 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, idx, 0, 0) < 0)
184 bb_perror_msg("cap_ambient_lower"); 184 bb_simple_perror_msg("cap_ambient_lower");
185 } 185 }
186 cap = strtok(NULL, ","); 186 cap = strtok(NULL, ",");
187 } 187 }
@@ -236,7 +236,7 @@ static int dump(void)
236 unsigned idx = CAP_TO_INDEX(i); 236 unsigned idx = CAP_TO_INDEX(i);
237 if (idx >= caps.u32s) { 237 if (idx >= caps.u32s) {
238 printf("\nindex: %u u32s: %u capability: %u\n", idx, caps.u32s, i); 238 printf("\nindex: %u u32s: %u capability: %u\n", idx, caps.u32s, i);
239 bb_error_msg_and_die("unsupported capability"); 239 bb_simple_error_msg_and_die("unsupported capability");
240 } 240 }
241 if (caps.data[idx].inheritable & CAP_TO_MASK(i)) { 241 if (caps.data[idx].inheritable & CAP_TO_MASK(i)) {
242 printf_cap(fmt, i); 242 printf_cap(fmt, i);
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index ae9d412d1..a483893ed 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -117,7 +117,7 @@ static void drop_capset(int cap_idx)
117 getcaps(&caps); 117 getcaps(&caps);
118 caps.data[CAP_TO_INDEX(cap_idx)].inheritable &= ~CAP_TO_MASK(cap_idx); 118 caps.data[CAP_TO_INDEX(cap_idx)].inheritable &= ~CAP_TO_MASK(cap_idx);
119 if (capset(&caps.header, caps.data) != 0) 119 if (capset(&caps.header, caps.data) != 0)
120 bb_perror_msg_and_die("capset"); 120 bb_simple_perror_msg_and_die("capset");
121} 121}
122 122
123static void drop_bounding_set(int cap_idx) 123static void drop_bounding_set(int cap_idx)
@@ -253,7 +253,7 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv)
253 if ((unsigned)stfs.f_type != RAMFS_MAGIC 253 if ((unsigned)stfs.f_type != RAMFS_MAGIC
254 && (unsigned)stfs.f_type != TMPFS_MAGIC 254 && (unsigned)stfs.f_type != TMPFS_MAGIC
255 ) { 255 ) {
256 bb_error_msg_and_die("root filesystem is not ramfs/tmpfs"); 256 bb_simple_error_msg_and_die("root filesystem is not ramfs/tmpfs");
257 } 257 }
258 258
259 if (!dry_run) { 259 if (!dry_run) {
@@ -263,7 +263,7 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv)
263 // Overmount / with newdir and chroot into it 263 // Overmount / with newdir and chroot into it
264 if (mount(".", "/", NULL, MS_MOVE, NULL)) { 264 if (mount(".", "/", NULL, MS_MOVE, NULL)) {
265 // For example, fails when newroot is not a mountpoint 265 // For example, fails when newroot is not a mountpoint
266 bb_perror_msg_and_die("error moving root"); 266 bb_simple_perror_msg_and_die("error moving root");
267 } 267 }
268 } 268 }
269 xchroot("."); 269 xchroot(".");
diff --git a/util-linux/uevent.c b/util-linux/uevent.c
index 2f8990ed9..7a1d7d4a7 100644
--- a/util-linux/uevent.c
+++ b/util-linux/uevent.c
@@ -75,12 +75,12 @@ int uevent_main(int argc UNUSED_PARAM, char **argv)
75 MAP_PRIVATE | MAP_ANON, 75 MAP_PRIVATE | MAP_ANON,
76 /* ignored: */ -1, 0); 76 /* ignored: */ -1, 0);
77 if (netbuf == MAP_FAILED) 77 if (netbuf == MAP_FAILED)
78 bb_perror_msg_and_die("mmap"); 78 bb_simple_perror_msg_and_die("mmap");
79 79
80 // Here we block, possibly for a very long time 80 // Here we block, possibly for a very long time
81 len = safe_read(fd, netbuf, BUFFER_SIZE - 1); 81 len = safe_read(fd, netbuf, BUFFER_SIZE - 1);
82 if (len < 0) 82 if (len < 0)
83 bb_perror_msg_and_die("read"); 83 bb_simple_perror_msg_and_die("read");
84 end = netbuf + len; 84 end = netbuf + len;
85 *end = '\0'; 85 *end = '\0';
86 86
diff --git a/util-linux/unshare.c b/util-linux/unshare.c
index 61fc71197..a943e7b03 100644
--- a/util-linux/unshare.c
+++ b/util-linux/unshare.c
@@ -239,7 +239,7 @@ int unshare_main(int argc UNUSED_PARAM, char **argv)
239 if (setgrp_str) { 239 if (setgrp_str) {
240 if (strcmp(setgrp_str, "allow") == 0) { 240 if (strcmp(setgrp_str, "allow") == 0) {
241 if (opts & OPT_map_root) { 241 if (opts & OPT_map_root) {
242 bb_error_msg_and_die( 242 bb_simple_error_msg_and_die(
243 "--setgroups=allow and --map-root-user " 243 "--setgroups=allow and --map-root-user "
244 "are mutually exclusive" 244 "are mutually exclusive"
245 ); 245 );