diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-04-21 18:18:48 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-04-21 18:18:48 +0200 |
commit | 47cfbf32fd66563f8c4e09ad6cced6abfbe2fad5 (patch) | |
tree | 05127e986021176649f2dd660a92ef8b8e107e92 | |
parent | e6a2f4cc5a47d3022bdf5ca2cacbaa5a8c5baf7a (diff) | |
download | busybox-w32-47cfbf32fd66563f8c4e09ad6cced6abfbe2fad5.tar.gz busybox-w32-47cfbf32fd66563f8c4e09ad6cced6abfbe2fad5.tar.bz2 busybox-w32-47cfbf32fd66563f8c4e09ad6cced6abfbe2fad5.zip |
*: add most of the required setup_common_bufsiz() calls
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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 { | |||
174 | #define G (*(struct globals*)bb_common_bufsiz1) | 174 | #define G (*(struct globals*)bb_common_bufsiz1) |
175 | void BUG_cpio_globals_too_big(void); | 175 | void BUG_cpio_globals_too_big(void); |
176 | #define INIT_G() do { \ | 176 | #define INIT_G() do { \ |
177 | setup_common_bufsiz(); \ | ||
177 | G.owner_ugid.uid = -1L; \ | 178 | G.owner_ugid.uid = -1L; \ |
178 | G.owner_ugid.gid = -1L; \ | 179 | G.owner_ugid.gid = -1L; \ |
179 | } while (0) | 180 | } 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 { | |||
445 | chksum_t chksum_out; | 445 | chksum_t chksum_out; |
446 | } FIX_ALIASING; | 446 | } FIX_ALIASING; |
447 | #define G (*(struct globals*)bb_common_bufsiz1) | 447 | #define G (*(struct globals*)bb_common_bufsiz1) |
448 | #define INIT_G() do { } while (0) | 448 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
449 | //#define G (*ptr_to_globals) | 449 | //#define G (*ptr_to_globals) |
450 | //#define INIT_G() do { | 450 | //#define INIT_G() do { |
451 | // SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); | 451 | // 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 { | |||
95 | int tagcount; | 95 | int tagcount; |
96 | } FIX_ALIASING; | 96 | } FIX_ALIASING; |
97 | #define G (*(struct globals*)bb_common_bufsiz1) | 97 | #define G (*(struct globals*)bb_common_bufsiz1) |
98 | #define INIT_G() do { } while (0) | 98 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
99 | 99 | ||
100 | static void extract_cpio(int fd, const char *source_rpm) | 100 | static void extract_cpio(int fd, const char *source_rpm) |
101 | { | 101 | { |
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 @@ | |||
19 | #define ESC "\033" | 19 | #define ESC "\033" |
20 | 20 | ||
21 | #define old_termios_p ((struct termios*)bb_common_bufsiz1) | 21 | #define old_termios_p ((struct termios*)bb_common_bufsiz1) |
22 | #define INIT_G() do { setup_common_bufsiz(); } while (0) | ||
22 | 23 | ||
23 | static void | 24 | static void |
24 | onintr(int sig UNUSED_PARAM) | 25 | onintr(int sig UNUSED_PARAM) |
@@ -34,6 +35,8 @@ int resize_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
34 | struct winsize w = { 0, 0, 0, 0 }; | 35 | struct winsize w = { 0, 0, 0, 0 }; |
35 | int ret; | 36 | int ret; |
36 | 37 | ||
38 | INIT_G(); | ||
39 | |||
37 | /* We use _stderr_ in order to make resize usable | 40 | /* We use _stderr_ in order to make resize usable |
38 | * in shell backticks (those redirect stdout away from tty). | 41 | * in shell backticks (those redirect stdout away from tty). |
39 | * NB: other versions of resize open "/dev/tty" | 42 | * 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 { | |||
111 | } FIX_ALIASING; | 111 | } FIX_ALIASING; |
112 | #define G (*(struct globals*)bb_common_bufsiz1) | 112 | #define G (*(struct globals*)bb_common_bufsiz1) |
113 | #define INIT_G() do { \ | 113 | #define INIT_G() do { \ |
114 | setup_common_bufsiz(); \ | ||
114 | /* we have to zero it out because of NOEXEC */ \ | 115 | /* we have to zero it out because of NOEXEC */ \ |
115 | memset(&G, 0, sizeof(G)); \ | 116 | memset(&G, 0, sizeof(G)); \ |
116 | } while (0) | 117 | } 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 { | |||
87 | dev_t dir_dev; | 87 | dev_t dir_dev; |
88 | } FIX_ALIASING; | 88 | } FIX_ALIASING; |
89 | #define G (*(struct globals*)bb_common_bufsiz1) | 89 | #define G (*(struct globals*)bb_common_bufsiz1) |
90 | #define INIT_G() do { } while (0) | 90 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
91 | 91 | ||
92 | 92 | ||
93 | static void print(unsigned long long size, const char *filename) | 93 | 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 { | |||
101 | char **args; | 101 | char **args; |
102 | } FIX_ALIASING; | 102 | } FIX_ALIASING; |
103 | #define G (*(struct globals*)bb_common_bufsiz1) | 103 | #define G (*(struct globals*)bb_common_bufsiz1) |
104 | #define INIT_G() do { } while (0) | 104 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
105 | 105 | ||
106 | /* forward declarations */ | 106 | /* forward declarations */ |
107 | static VALUE *eval(void); | 107 | 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 { | |||
368 | } FIX_ALIASING; | 368 | } FIX_ALIASING; |
369 | #define G (*(struct globals*)bb_common_bufsiz1) | 369 | #define G (*(struct globals*)bb_common_bufsiz1) |
370 | #define INIT_G() do { \ | 370 | #define INIT_G() do { \ |
371 | setup_common_bufsiz(); \ | ||
371 | /* we have to zero it out because of NOEXEC */ \ | 372 | /* we have to zero it out because of NOEXEC */ \ |
372 | memset(&G, 0, sizeof(G)); \ | 373 | memset(&G, 0, sizeof(G)); \ |
373 | IF_FEATURE_AUTOWIDTH(G_terminal_width = TERMINAL_WIDTH;) \ | 374 | 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 }; | |||
217 | #endif | 217 | #endif |
218 | #define G (*(struct globals*)bb_common_bufsiz1) | 218 | #define G (*(struct globals*)bb_common_bufsiz1) |
219 | #define INIT_G() do { \ | 219 | #define INIT_G() do { \ |
220 | setup_common_bufsiz(); \ | ||
220 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 221 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
221 | G.bytes_per_block = 32; \ | 222 | G.bytes_per_block = 32; \ |
222 | } while (0) | 223 | } 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 { | |||
56 | bool exitcode; | 56 | bool exitcode; |
57 | } FIX_ALIASING; | 57 | } FIX_ALIASING; |
58 | #define G (*(struct globals*)bb_common_bufsiz1) | 58 | #define G (*(struct globals*)bb_common_bufsiz1) |
59 | #define INIT_G() do { } while (0) | 59 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
60 | 60 | ||
61 | static void tail_xprint_header(const char *fmt, const char *filename) | 61 | static void tail_xprint_header(const char *fmt, const char *filename) |
62 | { | 62 | { |
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 { | |||
100 | #define names (G.names) | 100 | #define names (G.names) |
101 | #define cur (G.cur ) | 101 | #define cur (G.cur ) |
102 | #define cmd (G.cmd ) | 102 | #define cmd (G.cmd ) |
103 | #define INIT_G() do { } while (0) | 103 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
104 | 104 | ||
105 | enum { NUM_CMD = (COMMON_BUFSIZE - sizeof(G)) / sizeof(cmd[0]) - 1 }; | 105 | enum { NUM_CMD = (COMMON_BUFSIZE - sizeof(G)) / sizeof(cmd[0]) - 1 }; |
106 | 106 | ||
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 { | |||
200 | #define user_id (G.user_id ) | 200 | #define user_id (G.user_id ) |
201 | #define signal_nr (G.signal_nr ) | 201 | #define signal_nr (G.signal_nr ) |
202 | #define INIT_G() do { \ | 202 | #define INIT_G() do { \ |
203 | setup_common_bufsiz(); \ | ||
203 | user_id = -1; \ | 204 | user_id = -1; \ |
204 | signal_nr = 15; \ | 205 | signal_nr = 15; \ |
205 | } while (0) | 206 | } 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 { | |||
172 | } FIX_ALIASING; | 172 | } FIX_ALIASING; |
173 | #define G (*(struct globals*)bb_common_bufsiz1) | 173 | #define G (*(struct globals*)bb_common_bufsiz1) |
174 | #define INIT_G() do { \ | 174 | #define INIT_G() do { \ |
175 | setup_common_bufsiz(); \ | ||
175 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 176 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
176 | } while (0) | 177 | } while (0) |
177 | 178 | ||
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 { | |||
164 | } FIX_ALIASING; | 164 | } FIX_ALIASING; |
165 | #define G (*(struct globals*)bb_common_bufsiz1) | 165 | #define G (*(struct globals*)bb_common_bufsiz1) |
166 | #define INIT_G() do { \ | 166 | #define INIT_G() do { \ |
167 | setup_common_bufsiz(); \ | ||
167 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 168 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
168 | G.sed_cmd_tail = &G.sed_cmd_head; \ | 169 | G.sed_cmd_tail = &G.sed_cmd_head; \ |
169 | } while (0) | 170 | } 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 { | |||
424 | } FIX_ALIASING; | 424 | } FIX_ALIASING; |
425 | #define G (*(struct globals*)bb_common_bufsiz1) | 425 | #define G (*(struct globals*)bb_common_bufsiz1) |
426 | #define INIT_G() do { \ | 426 | #define INIT_G() do { \ |
427 | setup_common_bufsiz(); \ | ||
427 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 428 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
428 | /* we have to zero it out because of NOEXEC */ \ | 429 | /* we have to zero it out because of NOEXEC */ \ |
429 | memset(&G, 0, sizeof(G)); \ | 430 | 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 { | |||
204 | } FIX_ALIASING; | 204 | } FIX_ALIASING; |
205 | #define G (*(struct globals*)bb_common_bufsiz1) | 205 | #define G (*(struct globals*)bb_common_bufsiz1) |
206 | #define INIT_G() do { \ | 206 | #define INIT_G() do { \ |
207 | setup_common_bufsiz(); \ | ||
207 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 208 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
208 | } while (0) | 209 | } while (0) |
209 | #define max_matches (G.max_matches ) | 210 | #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 { | |||
103 | } FIX_ALIASING; | 103 | } FIX_ALIASING; |
104 | #define G (*(struct globals*)bb_common_bufsiz1) | 104 | #define G (*(struct globals*)bb_common_bufsiz1) |
105 | #define INIT_G() do { \ | 105 | #define INIT_G() do { \ |
106 | setup_common_bufsiz(); \ | ||
106 | G.eof_str = NULL; /* need to clear by hand because we are NOEXEC applet */ \ | 107 | G.eof_str = NULL; /* need to clear by hand because we are NOEXEC applet */ \ |
107 | IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.repl_str = "{}";) \ | 108 | IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.repl_str = "{}";) \ |
108 | IF_FEATURE_XARGS_SUPPORT_REPL_STR(G.eol_ch = '\n';) \ | 109 | 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 { | |||
117 | char jiffy_line[COMMON_BUFSIZE]; | 117 | char jiffy_line[COMMON_BUFSIZE]; |
118 | } FIX_ALIASING; | 118 | } FIX_ALIASING; |
119 | #define G (*(struct globals*)bb_common_bufsiz1) | 119 | #define G (*(struct globals*)bb_common_bufsiz1) |
120 | #define INIT_G() do { } while (0) | 120 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
121 | 121 | ||
122 | static void dump_file(FILE *fp, const char *filename) | 122 | static void dump_file(FILE *fp, const char *filename) |
123 | { | 123 | { |
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 { | |||
140 | struct termios tty_attrs; | 140 | struct termios tty_attrs; |
141 | } FIX_ALIASING; | 141 | } FIX_ALIASING; |
142 | #define G (*(struct globals*)bb_common_bufsiz1) | 142 | #define G (*(struct globals*)bb_common_bufsiz1) |
143 | #define INIT_G() do { } while (0) | 143 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
144 | 144 | ||
145 | 145 | ||
146 | #if ENABLE_FEATURE_NOLOGIN | 146 | #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 { | |||
143 | } FIX_ALIASING; | 143 | } FIX_ALIASING; |
144 | #define G (*(struct globals*)bb_common_bufsiz1) | 144 | #define G (*(struct globals*)bb_common_bufsiz1) |
145 | #define INIT_G() do { \ | 145 | #define INIT_G() do { \ |
146 | setup_common_bufsiz(); \ | ||
146 | G.log_level = 8; \ | 147 | G.log_level = 8; \ |
147 | G.crontab_dir_name = CRONTABS; \ | 148 | G.crontab_dir_name = CRONTABS; \ |
148 | } while (0) | 149 | } 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( | |||
53 | #define base (G.base ) | 53 | #define base (G.base ) |
54 | #define stack (G.stack ) | 54 | #define stack (G.stack ) |
55 | #define INIT_G() do { \ | 55 | #define INIT_G() do { \ |
56 | setup_common_bufsiz(); \ | ||
56 | base = 10; \ | 57 | base = 10; \ |
57 | } while (0) | 58 | } while (0) |
58 | 59 | ||
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 { | |||
432 | #define hwif_ctrl (G.hwif_ctrl ) | 432 | #define hwif_ctrl (G.hwif_ctrl ) |
433 | #define hwif_irq (G.hwif_irq ) | 433 | #define hwif_irq (G.hwif_irq ) |
434 | #define INIT_G() do { \ | 434 | #define INIT_G() do { \ |
435 | setup_common_bufsiz(); \ | ||
435 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 436 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
436 | } while (0) | 437 | } while (0) |
437 | 438 | ||
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 { | |||
76 | #define device (G.device ) | 76 | #define device (G.device ) |
77 | #define hw_set (G.hw_set ) | 77 | #define hw_set (G.hw_set ) |
78 | #define INIT_G() do { \ | 78 | #define INIT_G() do { \ |
79 | setup_common_bufsiz(); \ | ||
79 | device = ""; \ | 80 | device = ""; \ |
80 | } while (0) | 81 | } while (0) |
81 | 82 | ||
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 { | |||
77 | #define brd_recv (G.brd_recv ) | 77 | #define brd_recv (G.brd_recv ) |
78 | #define req_recv (G.req_recv ) | 78 | #define req_recv (G.req_recv ) |
79 | #define INIT_G() do { \ | 79 | #define INIT_G() do { \ |
80 | setup_common_bufsiz(); \ | ||
80 | count = -1; \ | 81 | count = -1; \ |
81 | } while (0) | 82 | } while (0) |
82 | 83 | ||
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 { | |||
126 | } FIX_ALIASING; | 126 | } FIX_ALIASING; |
127 | #define G (*(struct globals*)bb_common_bufsiz1) | 127 | #define G (*(struct globals*)bb_common_bufsiz1) |
128 | #define INIT_G() do { \ | 128 | #define INIT_G() do { \ |
129 | setup_common_bufsiz(); \ | ||
129 | /* Moved to main */ \ | 130 | /* Moved to main */ \ |
130 | /*strcpy(G.msg_ok + 4, MSG_OK );*/ \ | 131 | /*strcpy(G.msg_ok + 4, MSG_OK );*/ \ |
131 | /*strcpy(G.msg_err + 4, MSG_ERR);*/ \ | 132 | /*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) }; | |||
71 | #define do_continue (G.do_continue ) | 71 | #define do_continue (G.do_continue ) |
72 | #define buf (G.buf ) | 72 | #define buf (G.buf ) |
73 | #define INIT_G() do { \ | 73 | #define INIT_G() do { \ |
74 | setup_common_bufsiz(); \ | ||
74 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 75 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
75 | } while (0) | 76 | } while (0) |
76 | 77 | ||
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 { | |||
131 | char *shell; | 131 | char *shell; |
132 | } FIX_ALIASING; | 132 | } FIX_ALIASING; |
133 | #define G (*(struct globals*)bb_common_bufsiz1) | 133 | #define G (*(struct globals*)bb_common_bufsiz1) |
134 | #define INIT_G() do { } while (0) | 134 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
135 | 135 | ||
136 | 136 | ||
137 | static const char keywords_up_down[] ALIGN1 = | 137 | 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) }; | |||
350 | #define allsock (G.allsock ) | 350 | #define allsock (G.allsock ) |
351 | #define line (G.line ) | 351 | #define line (G.line ) |
352 | #define INIT_G() do { \ | 352 | #define INIT_G() do { \ |
353 | setup_common_bufsiz(); \ | ||
353 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 354 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
354 | rlim_ofile_cur = OPEN_MAX; \ | 355 | rlim_ofile_cur = OPEN_MAX; \ |
355 | global_queuelen = 128; \ | 356 | 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 { | |||
188 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; | 188 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; |
189 | } FIX_ALIASING; | 189 | } FIX_ALIASING; |
190 | #define G (*(struct globals*)bb_common_bufsiz1) | 190 | #define G (*(struct globals*)bb_common_bufsiz1) |
191 | #define INIT_G() do { } while (0) | 191 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
192 | 192 | ||
193 | static void noresp(int ign UNUSED_PARAM) | 193 | static void noresp(int ign UNUSED_PARAM) |
194 | { | 194 | { |
@@ -398,6 +398,7 @@ struct globals { | |||
398 | #define pingaddr (G.pingaddr ) | 398 | #define pingaddr (G.pingaddr ) |
399 | #define rcvd_tbl (G.rcvd_tbl ) | 399 | #define rcvd_tbl (G.rcvd_tbl ) |
400 | #define INIT_G() do { \ | 400 | #define INIT_G() do { \ |
401 | setup_common_bufsiz(); \ | ||
401 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 402 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
402 | datalen = DEFDATALEN; \ | 403 | datalen = DEFDATALEN; \ |
403 | timeout = MAXWAIT; \ | 404 | 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 { | |||
39 | #define handle (G.handle ) | 39 | #define handle (G.handle ) |
40 | #define saved_disc (G.saved_disc ) | 40 | #define saved_disc (G.saved_disc ) |
41 | #define saved_state (G.saved_state ) | 41 | #define saved_state (G.saved_state ) |
42 | #define INIT_G() do { } while (0) | 42 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
43 | 43 | ||
44 | 44 | ||
45 | /* | 45 | /* |
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 { | |||
71 | #define filter_prio (G.filter_prio) | 71 | #define filter_prio (G.filter_prio) |
72 | #define filter_proto (G.filter_proto) | 72 | #define filter_proto (G.filter_proto) |
73 | #define INIT_G() do { \ | 73 | #define INIT_G() do { \ |
74 | setup_common_bufsiz(); \ | ||
74 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 75 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
75 | } while (0) | 76 | } while (0) |
76 | 77 | ||
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 { | |||
101 | #define env_cur (G.env_cur ) | 101 | #define env_cur (G.env_cur ) |
102 | #define env_var (G.env_var ) | 102 | #define env_var (G.env_var ) |
103 | #define INIT_G() do { \ | 103 | #define INIT_G() do { \ |
104 | setup_common_bufsiz(); \ | ||
104 | cmax = 30; \ | 105 | cmax = 30; \ |
105 | env_cur = &env_var[0]; \ | 106 | env_cur = &env_var[0]; \ |
106 | } while (0) | 107 | } 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 { | |||
111 | } FIX_ALIASING; | 111 | } FIX_ALIASING; |
112 | #define G (*(struct globals*)bb_common_bufsiz1) | 112 | #define G (*(struct globals*)bb_common_bufsiz1) |
113 | #define INIT_G() do { \ | 113 | #define INIT_G() do { \ |
114 | setup_common_bufsiz(); \ | ||
114 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 115 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
115 | } while (0) | 116 | } while (0) |
116 | 117 | ||
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 { | |||
85 | } FIX_ALIASING; | 85 | } FIX_ALIASING; |
86 | #define G (*(struct globals*)bb_common_bufsiz1) | 86 | #define G (*(struct globals*)bb_common_bufsiz1) |
87 | #define INIT_G() do { \ | 87 | #define INIT_G() do { \ |
88 | setup_common_bufsiz(); \ | ||
88 | G.loginpath = "/bin/login"; \ | 89 | G.loginpath = "/bin/login"; \ |
89 | G.issuefile = "/etc/issue.net"; \ | 90 | G.issuefile = "/etc/issue.net"; \ |
90 | } while (0) | 91 | } 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 { | |||
131 | } FIX_ALIASING; | 131 | } FIX_ALIASING; |
132 | #define G (*(struct globals*)bb_common_bufsiz1) | 132 | #define G (*(struct globals*)bb_common_bufsiz1) |
133 | #define INIT_G() do { \ | 133 | #define INIT_G() do { \ |
134 | setup_common_bufsiz(); \ | ||
134 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 135 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
135 | } while (0) | 136 | } while (0) |
136 | 137 | ||
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 { | |||
34 | } FIX_ALIASING; | 34 | } FIX_ALIASING; |
35 | 35 | ||
36 | #define dhcprelay_xid_list (*(struct xid_item*)bb_common_bufsiz1) | 36 | #define dhcprelay_xid_list (*(struct xid_item*)bb_common_bufsiz1) |
37 | #define INIT_G() do { setup_common_bufsiz(); } while (0) | ||
37 | 38 | ||
38 | static struct xid_item *xid_add(uint32_t xid, struct sockaddr_in *ip, int client) | 39 | static struct xid_item *xid_add(uint32_t xid, struct sockaddr_in *ip, int client) |
39 | { | 40 | { |
@@ -257,6 +258,8 @@ int dhcprelay_main(int argc, char **argv) | |||
257 | int num_sockets, max_socket; | 258 | int num_sockets, max_socket; |
258 | uint32_t our_nip; | 259 | uint32_t our_nip; |
259 | 260 | ||
261 | INIT_G(); | ||
262 | |||
260 | server_addr.sin_family = AF_INET; | 263 | server_addr.sin_family = AF_INET; |
261 | server_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); | 264 | server_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); |
262 | server_addr.sin_port = htons(SERVER_PORT); | 265 | 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 { | |||
92 | uint32_t localnet_ip; | 92 | uint32_t localnet_ip; |
93 | } FIX_ALIASING; | 93 | } FIX_ALIASING; |
94 | #define G (*(struct globals*)bb_common_bufsiz1) | 94 | #define G (*(struct globals*)bb_common_bufsiz1) |
95 | #define INIT_G() do { } while (0) | 95 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
96 | 96 | ||
97 | 97 | ||
98 | /** | 98 | /** |
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 { | |||
37 | #endif | 37 | #endif |
38 | } FIX_ALIASING; | 38 | } FIX_ALIASING; |
39 | #define G (*(struct globals*)bb_common_bufsiz1) | 39 | #define G (*(struct globals*)bb_common_bufsiz1) |
40 | #define INIT_G() do { } while (0) | 40 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
41 | 41 | ||
42 | 42 | ||
43 | static unsigned long long scale(unsigned long d) | 43 | 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 { | |||
46 | } FIX_ALIASING; | 46 | } FIX_ALIASING; |
47 | #define G (*(struct globals*)bb_common_bufsiz1) | 47 | #define G (*(struct globals*)bb_common_bufsiz1) |
48 | #define INIT_G() do { \ | 48 | #define INIT_G() do { \ |
49 | setup_common_bufsiz(); \ | ||
49 | G.mypid = getpid(); \ | 50 | G.mypid = getpid(); \ |
50 | G.killsig = SIGKILL; \ | 51 | G.killsig = SIGKILL; \ |
51 | } while (0) | 52 | } 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 { | |||
153 | #define buffer (G.buffer ) | 153 | #define buffer (G.buffer ) |
154 | #define terminal_width (G.terminal_width ) | 154 | #define terminal_width (G.terminal_width ) |
155 | #define kernel_HZ (G.kernel_HZ ) | 155 | #define kernel_HZ (G.kernel_HZ ) |
156 | #define INIT_G() do { } while (0) | 156 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
157 | 157 | ||
158 | #if ENABLE_FEATURE_PS_TIME | 158 | #if ENABLE_FEATURE_PS_TIME |
159 | /* for ELF executables, notes are pushed before environment and args */ | 159 | /* 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) }; | |||
202 | #define total_pcpu (G.total_pcpu ) | 202 | #define total_pcpu (G.total_pcpu ) |
203 | #define line_buf (G.line_buf ) | 203 | #define line_buf (G.line_buf ) |
204 | #define INIT_G() do { \ | 204 | #define INIT_G() do { \ |
205 | setup_common_bufsiz(); \ | ||
205 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 206 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
206 | BUILD_BUG_ON(LINE_BUF_SIZE <= 80); \ | 207 | BUILD_BUG_ON(LINE_BUF_SIZE <= 80); \ |
207 | } while (0) | 208 | } 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 { | |||
115 | #define dir (G.dir ) | 115 | #define dir (G.dir ) |
116 | #define svd (G.svd ) | 116 | #define svd (G.svd ) |
117 | #define INIT_G() do { \ | 117 | #define INIT_G() do { \ |
118 | setup_common_bufsiz(); \ | ||
118 | pidchanged = 1; \ | 119 | pidchanged = 1; \ |
119 | } while (0) | 120 | } while (0) |
120 | 121 | ||
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 { | |||
93 | #define logpipe (G.logpipe ) | 93 | #define logpipe (G.logpipe ) |
94 | #define pfd (G.pfd ) | 94 | #define pfd (G.pfd ) |
95 | #define stamplog (G.stamplog ) | 95 | #define stamplog (G.stamplog ) |
96 | #define INIT_G() do { } while (0) | 96 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
97 | 97 | ||
98 | static void fatal2_cannot(const char *m1, const char *m2) | 98 | static void fatal2_cannot(const char *m1, const char *m2) |
99 | { | 99 | { |
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 { | |||
207 | #define tstart (G.tstart ) | 207 | #define tstart (G.tstart ) |
208 | #define tnow (G.tnow ) | 208 | #define tnow (G.tnow ) |
209 | #define svstatus (G.svstatus ) | 209 | #define svstatus (G.svstatus ) |
210 | #define INIT_G() do { } while (0) | 210 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
211 | 211 | ||
212 | 212 | ||
213 | #define str_equal(s,t) (!strcmp((s), (t))) | 213 | #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 | |||
111 | 111 | ||
112 | if test $OLD != $REM; then | 112 | if test $OLD != $REM; then |
113 | echo "Space in _end[] is $REM bytes. Rerun make to use larger COMMON_BUFSIZE." | 113 | echo "Space in _end[] is $REM bytes. Rerun make to use larger COMMON_BUFSIZE." |
114 | else | ||
115 | echo "COMMON_BUFSIZE = $REM bytes" | ||
114 | fi | 116 | 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 { | |||
80 | #define G (*(struct globals*)bb_common_bufsiz1) | 80 | #define G (*(struct globals*)bb_common_bufsiz1) |
81 | void BUG_setfiles_globals_too_big(void); | 81 | void BUG_setfiles_globals_too_big(void); |
82 | #define INIT_G() do { \ | 82 | #define INIT_G() do { \ |
83 | setup_common_bufsiz(); \ | ||
83 | if (sizeof(G) > COMMON_BUFSIZE) \ | 84 | if (sizeof(G) > COMMON_BUFSIZE) \ |
84 | BUG_setfiles_globals_too_big(); \ | 85 | BUG_setfiles_globals_too_big(); \ |
85 | /* memset(&G, 0, sizeof(G)); - already is */ \ | 86 | /* 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 { | |||
73 | #define SMrdn (G.SMrdn) | 73 | #define SMrdn (G.SMrdn) |
74 | #define shbuf (G.shbuf) | 74 | #define shbuf (G.shbuf) |
75 | #define INIT_G() do { \ | 75 | #define INIT_G() do { \ |
76 | setup_common_bufsiz(); \ | ||
76 | memcpy(SMrup, init_sem, sizeof(init_sem)); \ | 77 | memcpy(SMrup, init_sem, sizeof(init_sem)); \ |
77 | } while (0) | 78 | } while (0) |
78 | 79 | ||
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 { | |||
288 | } FIX_ALIASING; | 288 | } FIX_ALIASING; |
289 | #define G (*(struct globals*)bb_common_bufsiz1) | 289 | #define G (*(struct globals*)bb_common_bufsiz1) |
290 | #define INIT_G() do { \ | 290 | #define INIT_G() do { \ |
291 | setup_common_bufsiz(); \ | ||
291 | IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.maj = -1;) \ | 292 | IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.maj = -1;) \ |
292 | IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.mode = 0660;) \ | 293 | IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.mode = 0660;) \ |
293 | } while (0) | 294 | } 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 { | |||
76 | 76 | ||
77 | #define NWORDS 129 | 77 | #define NWORDS 129 |
78 | #define hdr ((struct swap_header_v1*)bb_common_bufsiz1) | 78 | #define hdr ((struct swap_header_v1*)bb_common_bufsiz1) |
79 | #define INIT_G() do { setup_common_bufsiz(); } while (0) | ||
79 | 80 | ||
80 | struct BUG_sizes { | 81 | struct BUG_sizes { |
81 | char swap_header_v1_wrong[sizeof(*hdr) != (NWORDS * 4) ? -1 : 1]; | 82 | char swap_header_v1_wrong[sizeof(*hdr) != (NWORDS * 4) ? -1 : 1]; |
@@ -93,6 +94,8 @@ int mkswap_main(int argc UNUSED_PARAM, char **argv) | |||
93 | off_t len; | 94 | off_t len; |
94 | const char *label = ""; | 95 | const char *label = ""; |
95 | 96 | ||
97 | INIT_G(); | ||
98 | |||
96 | opt_complementary = "-1"; /* at least one param */ | 99 | opt_complementary = "-1"; /* at least one param */ |
97 | /* TODO: -p PAGESZ, -U UUID */ | 100 | /* TODO: -p PAGESZ, -U UUID */ |
98 | getopt32(argv, "L:", &label); | 101 | 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 { | |||
33 | struct termios new_settings; | 33 | struct termios new_settings; |
34 | } FIX_ALIASING; | 34 | } FIX_ALIASING; |
35 | #define G (*(struct globals*)bb_common_bufsiz1) | 35 | #define G (*(struct globals*)bb_common_bufsiz1) |
36 | #define INIT_G() ((void)0) | ||
37 | #define initial_settings (G.initial_settings) | 36 | #define initial_settings (G.initial_settings) |
38 | #define new_settings (G.new_settings ) | 37 | #define new_settings (G.new_settings ) |
39 | #define cin_fileno (G.cin_fileno ) | 38 | #define cin_fileno (G.cin_fileno ) |
39 | #define INIT_G() do { setup_common_bufsiz(); } while (0) | ||
40 | 40 | ||
41 | #define setTermSettings(fd, argp) \ | 41 | #define setTermSettings(fd, argp) \ |
42 | do { \ | 42 | 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 | |||
457 | #endif | 457 | #endif |
458 | #define fslist (G.fslist ) | 458 | #define fslist (G.fslist ) |
459 | #define getmntent_buf (G.getmntent_buf ) | 459 | #define getmntent_buf (G.getmntent_buf ) |
460 | #define INIT_G() do { } while (0) | 460 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
461 | 461 | ||
462 | #if ENABLE_FEATURE_MTAB_SUPPORT | 462 | #if ENABLE_FEATURE_MTAB_SUPPORT |
463 | /* | 463 | /* |
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 { | |||
72 | #define save_g_flags() ((void)0) | 72 | #define save_g_flags() ((void)0) |
73 | #define restore_g_flags() ((void)0) | 73 | #define restore_g_flags() ((void)0) |
74 | #endif | 74 | #endif |
75 | #define INIT_G() do { } while (0) | 75 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
76 | 76 | ||
77 | #define do_swapoff (applet_name[5] == 'f') | 77 | #define do_swapoff (applet_name[5] == 'f') |
78 | 78 | ||
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 @@ | |||
31 | #define BUFFER_SIZE 16*1024 | 31 | #define BUFFER_SIZE 16*1024 |
32 | 32 | ||
33 | #define env ((char **)bb_common_bufsiz1) | 33 | #define env ((char **)bb_common_bufsiz1) |
34 | #define INIT_G() do { setup_common_bufsiz(); } while (0) | ||
34 | enum { | 35 | enum { |
35 | MAX_ENV = COMMON_BUFSIZE / sizeof(env[0]) - 1, | 36 | MAX_ENV = COMMON_BUFSIZE / sizeof(env[0]) - 1, |
36 | }; | 37 | }; |
@@ -46,6 +47,8 @@ int uevent_main(int argc UNUSED_PARAM, char **argv) | |||
46 | struct sockaddr_nl sa; | 47 | struct sockaddr_nl sa; |
47 | int fd; | 48 | int fd; |
48 | 49 | ||
50 | INIT_G(); | ||
51 | |||
49 | argv++; | 52 | argv++; |
50 | 53 | ||
51 | // Subscribe for UEVENT kernel messages | 54 | // Subscribe for UEVENT kernel messages |