aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/cpio.c1
-rw-r--r--archival/lzop.c2
-rw-r--r--archival/rpm.c2
-rw-r--r--console-tools/resize.c3
-rw-r--r--coreutils/dd.c1
-rw-r--r--coreutils/du.c2
-rw-r--r--coreutils/expr.c2
-rw-r--r--coreutils/ls.c1
-rw-r--r--coreutils/od_bloaty.c1
-rw-r--r--coreutils/tail.c2
-rw-r--r--debianutils/run_parts.c2
-rw-r--r--debianutils/start_stop_daemon.c1
-rw-r--r--e2fsprogs/fsck.c1
-rw-r--r--editors/sed.c1
-rw-r--r--findutils/find.c1
-rw-r--r--findutils/grep.c1
-rw-r--r--findutils/xargs.c1
-rw-r--r--init/bootchartd.c2
-rw-r--r--loginutils/login.c2
-rw-r--r--miscutils/crond.c1
-rw-r--r--miscutils/dc.c1
-rw-r--r--miscutils/hdparm.c1
-rw-r--r--networking/arp.c1
-rw-r--r--networking/arping.c1
-rw-r--r--networking/ftpd.c1
-rw-r--r--networking/ftpgetput.c1
-rw-r--r--networking/ifupdown.c2
-rw-r--r--networking/inetd.c1
-rw-r--r--networking/ping.c3
-rw-r--r--networking/slattach.c2
-rw-r--r--networking/tc.c1
-rw-r--r--networking/tcpudp.c1
-rw-r--r--networking/telnet.c1
-rw-r--r--networking/telnetd.c1
-rw-r--r--networking/tftp.c1
-rw-r--r--networking/udhcp/dhcprelay.c3
-rw-r--r--networking/zcip.c2
-rw-r--r--procps/free.c2
-rw-r--r--procps/fuser.c1
-rw-r--r--procps/ps.c2
-rw-r--r--procps/top.c1
-rw-r--r--runit/runsv.c1
-rw-r--r--runit/runsvdir.c2
-rw-r--r--runit/sv.c2
-rwxr-xr-xscripts/generate_BUFSIZ.sh2
-rw-r--r--selinux/setfiles.c1
-rw-r--r--sysklogd/logread.c1
-rw-r--r--util-linux/mdev.c1
-rw-r--r--util-linux/mkswap.c3
-rw-r--r--util-linux/more.c2
-rw-r--r--util-linux/mount.c2
-rw-r--r--util-linux/swaponoff.c2
-rw-r--r--util-linux/uevent.c3
53 files changed, 63 insertions, 19 deletions
diff --git a/archival/cpio.c b/archival/cpio.c
index a3036e1ab..3b1550720 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -174,6 +174,7 @@ struct globals {
#define G (*(struct globals*)bb_common_bufsiz1)
void BUG_cpio_globals_too_big(void);
#define INIT_G() do { \
+ setup_common_bufsiz(); \
G.owner_ugid.uid = -1L; \
G.owner_ugid.gid = -1L; \
} while (0)
diff --git a/archival/lzop.c b/archival/lzop.c
index 1371c9751..4afa21889 100644
--- a/archival/lzop.c
+++ b/archival/lzop.c
@@ -445,7 +445,7 @@ struct globals {
chksum_t chksum_out;
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
//#define G (*ptr_to_globals)
//#define INIT_G() do {
// SET_PTR_TO_GLOBALS(xzalloc(sizeof(G)));
diff --git a/archival/rpm.c b/archival/rpm.c
index 079b7a95b..83160f975 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -95,7 +95,7 @@ struct globals {
int tagcount;
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static void extract_cpio(int fd, const char *source_rpm)
{
diff --git a/console-tools/resize.c b/console-tools/resize.c
index ed80aa082..a3342a195 100644
--- a/console-tools/resize.c
+++ b/console-tools/resize.c
@@ -19,6 +19,7 @@
#define ESC "\033"
#define old_termios_p ((struct termios*)bb_common_bufsiz1)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static void
onintr(int sig UNUSED_PARAM)
@@ -34,6 +35,8 @@ int resize_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
struct winsize w = { 0, 0, 0, 0 };
int ret;
+ INIT_G();
+
/* We use _stderr_ in order to make resize usable
* in shell backticks (those redirect stdout away from tty).
* NB: other versions of resize open "/dev/tty"
diff --git a/coreutils/dd.c b/coreutils/dd.c
index a5b8882a0..4dc302926 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -111,6 +111,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
/* we have to zero it out because of NOEXEC */ \
memset(&G, 0, sizeof(G)); \
} while (0)
diff --git a/coreutils/du.c b/coreutils/du.c
index 3d6777670..1240bcbbc 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -87,7 +87,7 @@ struct globals {
dev_t dir_dev;
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static void print(unsigned long long size, const char *filename)
diff --git a/coreutils/expr.c b/coreutils/expr.c
index 59a66d9c5..ce6b2d189 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -101,7 +101,7 @@ struct globals {
char **args;
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
/* forward declarations */
static VALUE *eval(void);
diff --git a/coreutils/ls.c b/coreutils/ls.c
index e8c3e0490..344b4e61e 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -368,6 +368,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
/* we have to zero it out because of NOEXEC */ \
memset(&G, 0, sizeof(G)); \
IF_FEATURE_AUTOWIDTH(G_terminal_width = TERMINAL_WIDTH;) \
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 1e252caf0..c8a654165 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -217,6 +217,7 @@ enum { G_pseudo_offset = 0 };
#endif
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
G.bytes_per_block = 32; \
} while (0)
diff --git a/coreutils/tail.c b/coreutils/tail.c
index cdc9fb66a..39f87679e 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -56,7 +56,7 @@ struct globals {
bool exitcode;
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static void tail_xprint_header(const char *fmt, const char *filename)
{
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c
index a5e53576c..c671b9252 100644
--- a/debianutils/run_parts.c
+++ b/debianutils/run_parts.c
@@ -100,7 +100,7 @@ struct globals {
#define names (G.names)
#define cur (G.cur )
#define cmd (G.cmd )
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
enum { NUM_CMD = (COMMON_BUFSIZE - sizeof(G)) / sizeof(cmd[0]) - 1 };
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 6b8d53b13..3625ffee8 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -200,6 +200,7 @@ struct globals {
#define user_id (G.user_id )
#define signal_nr (G.signal_nr )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
user_id = -1; \
signal_nr = 15; \
} while (0)
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index b534568c2..59514a1a6 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -172,6 +172,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
} while (0)
diff --git a/editors/sed.c b/editors/sed.c
index 330190e78..ed48de17f 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -164,6 +164,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
G.sed_cmd_tail = &G.sed_cmd_head; \
} while (0)
diff --git a/findutils/find.c b/findutils/find.c
index 32d830337..d71c69782 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -424,6 +424,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
/* we have to zero it out because of NOEXEC */ \
memset(&G, 0, sizeof(G)); \
diff --git a/findutils/grep.c b/findutils/grep.c
index a669ac80b..b072cd441 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -204,6 +204,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
} while (0)
#define max_matches (G.max_matches )
diff --git a/findutils/xargs.c b/findutils/xargs.c
index bfbd94960..ae01a49be 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -103,6 +103,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
G.eof_str = NULL; /* need to clear by hand because we are NOEXEC applet */ \
IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.repl_str = "{}";) \
IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.eol_ch = '\n';) \
diff --git a/init/bootchartd.c b/init/bootchartd.c
index 5101b28ae..7f511e650 100644
--- a/init/bootchartd.c
+++ b/init/bootchartd.c
@@ -117,7 +117,7 @@ struct globals {
char jiffy_line[COMMON_BUFSIZE];
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static void dump_file(FILE *fp, const char *filename)
{
diff --git a/loginutils/login.c b/loginutils/login.c
index ea7c5a23d..94b6c45db 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -140,7 +140,7 @@ struct globals {
struct termios tty_attrs;
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
#if ENABLE_FEATURE_NOLOGIN
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 8536d43c5..f96c96ee7 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -143,6 +143,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
G.log_level = 8; \
G.crontab_dir_name = CRONTABS; \
} while (0)
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 3fbb89f5b..4d92bc3d0 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -53,6 +53,7 @@ enum { STACK_SIZE = (COMMON_BUFSIZE - offsetof(struct globals, stack)) / sizeof(
#define base (G.base )
#define stack (G.stack )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
base = 10; \
} while (0)
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 9e141de2f..b4c5876d4 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -432,6 +432,7 @@ struct globals {
#define hwif_ctrl (G.hwif_ctrl )
#define hwif_irq (G.hwif_irq )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
} while (0)
diff --git a/networking/arp.c b/networking/arp.c
index 5f7818663..9381eb53a 100644
--- a/networking/arp.c
+++ b/networking/arp.c
@@ -76,6 +76,7 @@ struct globals {
#define device (G.device )
#define hw_set (G.hw_set )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
device = ""; \
} while (0)
diff --git a/networking/arping.c b/networking/arping.c
index 52f5ba51f..6b0de4de2 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -77,6 +77,7 @@ struct globals {
#define brd_recv (G.brd_recv )
#define req_recv (G.req_recv )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
count = -1; \
} while (0)
diff --git a/networking/ftpd.c b/networking/ftpd.c
index 8553a28f5..360d1e6be 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -126,6 +126,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
/* Moved to main */ \
/*strcpy(G.msg_ok + 4, MSG_OK );*/ \
/*strcpy(G.msg_err + 4, MSG_ERR);*/ \
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index 61bc45c4e..91fb4569a 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -71,6 +71,7 @@ enum { BUFSZ = COMMON_BUFSIZE - offsetof(struct globals, buf) };
#define do_continue (G.do_continue )
#define buf (G.buf )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
} while (0)
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 399ff6b5d..25b04c9d7 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -131,7 +131,7 @@ struct globals {
char *shell;
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static const char keywords_up_down[] ALIGN1 =
diff --git a/networking/inetd.c b/networking/inetd.c
index aa35ffa2b..8d44b5198 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -350,6 +350,7 @@ enum { LINE_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line) };
#define allsock (G.allsock )
#define line (G.line )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
rlim_ofile_cur = OPEN_MAX; \
global_queuelen = 128; \
diff --git a/networking/ping.c b/networking/ping.c
index 761660979..cfe682646 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -188,7 +188,7 @@ struct globals {
char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static void noresp(int ign UNUSED_PARAM)
{
@@ -398,6 +398,7 @@ struct globals {
#define pingaddr (G.pingaddr )
#define rcvd_tbl (G.rcvd_tbl )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
datalen = DEFDATALEN; \
timeout = MAXWAIT; \
diff --git a/networking/slattach.c b/networking/slattach.c
index d9d8fe7b8..2d1305e32 100644
--- a/networking/slattach.c
+++ b/networking/slattach.c
@@ -39,7 +39,7 @@ struct globals {
#define handle (G.handle )
#define saved_disc (G.saved_disc )
#define saved_state (G.saved_state )
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
/*
diff --git a/networking/tc.c b/networking/tc.c
index 1372ca081..d0bcbdeaa 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -71,6 +71,7 @@ struct globals {
#define filter_prio (G.filter_prio)
#define filter_proto (G.filter_proto)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
} while (0)
diff --git a/networking/tcpudp.c b/networking/tcpudp.c
index 624973042..31bc70459 100644
--- a/networking/tcpudp.c
+++ b/networking/tcpudp.c
@@ -101,6 +101,7 @@ struct globals {
#define env_cur (G.env_cur )
#define env_var (G.env_var )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
cmax = 30; \
env_cur = &env_var[0]; \
} while (0)
diff --git a/networking/telnet.c b/networking/telnet.c
index 2946bc831..d2daf5c8c 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -111,6 +111,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
} while (0)
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 13d5a8f64..13c36aa46 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -85,6 +85,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
G.loginpath = "/bin/login"; \
G.issuefile = "/etc/issue.net"; \
} while (0)
diff --git a/networking/tftp.c b/networking/tftp.c
index 8aeb79aca..e879c4674 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -131,6 +131,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
} while (0)
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index 1722a85de..f52a0cf88 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -34,6 +34,7 @@ struct xid_item {
} FIX_ALIASING;
#define dhcprelay_xid_list (*(struct xid_item*)bb_common_bufsiz1)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static struct xid_item *xid_add(uint32_t xid, struct sockaddr_in *ip, int client)
{
@@ -257,6 +258,8 @@ int dhcprelay_main(int argc, char **argv)
int num_sockets, max_socket;
uint32_t our_nip;
+ INIT_G();
+
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST);
server_addr.sin_port = htons(SERVER_PORT);
diff --git a/networking/zcip.c b/networking/zcip.c
index 79643458c..47f3216a0 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -92,7 +92,7 @@ struct globals {
uint32_t localnet_ip;
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
/**
diff --git a/procps/free.c b/procps/free.c
index 9fde64b64..fca9a2242 100644
--- a/procps/free.c
+++ b/procps/free.c
@@ -37,7 +37,7 @@ struct globals {
#endif
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static unsigned long long scale(unsigned long d)
diff --git a/procps/fuser.c b/procps/fuser.c
index 2cda0f9d7..6dac852ed 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -46,6 +46,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
G.mypid = getpid(); \
G.killsig = SIGKILL; \
} while (0)
diff --git a/procps/ps.c b/procps/ps.c
index 65d62e256..08dfce12e 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -153,7 +153,7 @@ struct globals {
#define buffer (G.buffer )
#define terminal_width (G.terminal_width )
#define kernel_HZ (G.kernel_HZ )
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
#if ENABLE_FEATURE_PS_TIME
/* for ELF executables, notes are pushed before environment and args */
diff --git a/procps/top.c b/procps/top.c
index 1c42b249c..640bcdc6d 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -202,6 +202,7 @@ enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) };
#define total_pcpu (G.total_pcpu )
#define line_buf (G.line_buf )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
BUILD_BUG_ON(LINE_BUF_SIZE <= 80); \
} while (0)
diff --git a/runit/runsv.c b/runit/runsv.c
index 8833f4c96..e0e31508a 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -115,6 +115,7 @@ struct globals {
#define dir (G.dir )
#define svd (G.svd )
#define INIT_G() do { \
+ setup_common_bufsiz(); \
pidchanged = 1; \
} while (0)
diff --git a/runit/runsvdir.c b/runit/runsvdir.c
index 49c8f5b48..2b7927542 100644
--- a/runit/runsvdir.c
+++ b/runit/runsvdir.c
@@ -93,7 +93,7 @@ struct globals {
#define logpipe (G.logpipe )
#define pfd (G.pfd )
#define stamplog (G.stamplog )
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
static void fatal2_cannot(const char *m1, const char *m2)
{
diff --git a/runit/sv.c b/runit/sv.c
index e83a29781..2a256a6b4 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -207,7 +207,7 @@ struct globals {
#define tstart (G.tstart )
#define tnow (G.tnow )
#define svstatus (G.svstatus )
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
#define str_equal(s,t) (!strcmp((s), (t)))
diff --git a/scripts/generate_BUFSIZ.sh b/scripts/generate_BUFSIZ.sh
index afe9eee1e..bb0738641 100755
--- a/scripts/generate_BUFSIZ.sh
+++ b/scripts/generate_BUFSIZ.sh
@@ -111,4 +111,6 @@ fi
if test $OLD != $REM; then
echo "Space in _end[] is $REM bytes. Rerun make to use larger COMMON_BUFSIZE."
+else
+ echo "COMMON_BUFSIZE = $REM bytes"
fi
diff --git a/selinux/setfiles.c b/selinux/setfiles.c
index 441345ae9..51a7e63bd 100644
--- a/selinux/setfiles.c
+++ b/selinux/setfiles.c
@@ -80,6 +80,7 @@ struct globals {
#define G (*(struct globals*)bb_common_bufsiz1)
void BUG_setfiles_globals_too_big(void);
#define INIT_G() do { \
+ setup_common_bufsiz(); \
if (sizeof(G) > COMMON_BUFSIZE) \
BUG_setfiles_globals_too_big(); \
/* memset(&G, 0, sizeof(G)); - already is */ \
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index ebd7f8b2c..5b999730a 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -73,6 +73,7 @@ struct globals {
#define SMrdn (G.SMrdn)
#define shbuf (G.shbuf)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
memcpy(SMrup, init_sem, sizeof(init_sem)); \
} while (0)
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 7473b1855..37514eb54 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -288,6 +288,7 @@ struct globals {
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
+ setup_common_bufsiz(); \
IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.maj = -1;) \
IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.mode = 0660;) \
} while (0)
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index f9451792b..dcb53f008 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -76,6 +76,7 @@ struct swap_header_v1 {
#define NWORDS 129
#define hdr ((struct swap_header_v1*)bb_common_bufsiz1)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
struct BUG_sizes {
char swap_header_v1_wrong[sizeof(*hdr) != (NWORDS * 4) ? -1 : 1];
@@ -93,6 +94,8 @@ int mkswap_main(int argc UNUSED_PARAM, char **argv)
off_t len;
const char *label = "";
+ INIT_G();
+
opt_complementary = "-1"; /* at least one param */
/* TODO: -p PAGESZ, -U UUID */
getopt32(argv, "L:", &label);
diff --git a/util-linux/more.c b/util-linux/more.c
index 58be3ac3b..95cbdd994 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -33,10 +33,10 @@ struct globals {
struct termios new_settings;
} FIX_ALIASING;
#define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() ((void)0)
#define initial_settings (G.initial_settings)
#define new_settings (G.new_settings )
#define cin_fileno (G.cin_fileno )
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
#define setTermSettings(fd, argp) \
do { \
diff --git a/util-linux/mount.c b/util-linux/mount.c
index e5c85feff..244f4fa27 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -457,7 +457,7 @@ enum { GETMNTENT_BUFSIZE = COMMON_BUFSIZE - offsetof(struct globals, getmntent_b
#endif
#define fslist (G.fslist )
#define getmntent_buf (G.getmntent_buf )
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
#if ENABLE_FEATURE_MTAB_SUPPORT
/*
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 43228a6ba..6713852e5 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -72,7 +72,7 @@ struct globals {
#define save_g_flags() ((void)0)
#define restore_g_flags() ((void)0)
#endif
-#define INIT_G() do { } while (0)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
#define do_swapoff (applet_name[5] == 'f')
diff --git a/util-linux/uevent.c b/util-linux/uevent.c
index 58668fa5d..b98fe6160 100644
--- a/util-linux/uevent.c
+++ b/util-linux/uevent.c
@@ -31,6 +31,7 @@
#define BUFFER_SIZE 16*1024
#define env ((char **)bb_common_bufsiz1)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
enum {
MAX_ENV = COMMON_BUFSIZE / sizeof(env[0]) - 1,
};
@@ -46,6 +47,8 @@ int uevent_main(int argc UNUSED_PARAM, char **argv)
struct sockaddr_nl sa;
int fd;
+ INIT_G();
+
argv++;
// Subscribe for UEVENT kernel messages