aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mdev.c5
-rw-r--r--util-linux/mount.c3
-rw-r--r--util-linux/swaponoff.c3
3 files changed, 11 insertions, 0 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 27b35572d..c56741b08 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -173,6 +173,8 @@ struct globals {
char *subsystem;
} FIX_ALIASING;
#define G (*(struct globals*)&bb_common_bufsiz1)
+#define INIT_G() do { } while (0)
+
/* Prevent infinite loops in /sys symlinks */
#define MAX_SYSFS_DEPTH 3
@@ -180,6 +182,7 @@ struct globals {
/* We use additional 64+ bytes in make_device() */
#define SCRATCH_SIZE 80
+
/* Builds an alias path.
* This function potentionally reallocates the alias parameter.
* Only used for ENABLE_FEATURE_MDEV_RENAME
@@ -613,6 +616,8 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
{
RESERVE_CONFIG_BUFFER(temp, PATH_MAX + SCRATCH_SIZE);
+ INIT_G();
+
/* We can be called as hotplug helper */
/* Kernel cannot provide suitable stdio fds for us, do it ourself */
bb_sanitize_stdio();
diff --git a/util-linux/mount.c b/util-linux/mount.c
index b51ab1782..56276ef01 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -339,6 +339,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)
#if ENABLE_FEATURE_MTAB_SUPPORT
/*
@@ -1944,6 +1945,8 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
IF_DESKTOP(int nonroot = ) sanitize_env_if_suid();
+ INIT_G();
+
// Parse long options, like --bind and --move. Note that -o option
// and --option are synonymous. Yes, this means --remount,rw works.
for (i = j = 1; argv[i]; i++) {
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index e53e24c71..b3057b309 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -48,6 +48,7 @@ struct globals {
#else
#define g_flags 0
#endif
+#define INIT_G() do { } while (0)
static int swap_enable_disable(char *device)
{
@@ -111,6 +112,8 @@ int swap_on_off_main(int argc UNUSED_PARAM, char **argv)
{
int ret;
+ INIT_G();
+
#if !ENABLE_FEATURE_SWAPON_PRI
ret = getopt32(argv, "a");
#else