summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorlhb-jr <lhb.jr@gmx.com>2014-03-21 12:04:32 -0400
committerlhb-jr <lhb.jr@gmx.com>2014-03-21 12:04:32 -0400
commit123cccd8332df85343891e01d050cda2cf221a78 (patch)
tree4ce6ae6abcde14840726c212f43f3d50d37db512 /src/udev
parentc0acbd0656ae0aeaa53f1d291fdee385ea43f7ff (diff)
workaround 'discards const' warning during compile
modified: src/udev/udev-builtin-kmod.c Temporary copies of the arguments to the 'execv' call are made so that gcc doesn't give, possibly confusing warning about 'discarding const' during compilation.
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-builtin-kmod.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c
index a9704c101c..57e2a9af7f 100644
--- a/src/udev/udev-builtin-kmod.c
+++ b/src/udev/udev-builtin-kmod.c
@@ -67,8 +67,21 @@ static int load_module(struct udev *udev, const char *alias)
kmod_module_unref_list(list);
return err;
#else
- char *const argv[] = { MODPROBE, "-bq", alias, 0 };
- return execute_command(MODPROBE, argv);
+ int retval;
+
+ /*
+ These 3 temporaries are needed because argv (below) is a const pointer, not pointer to const
+ */
+ char *tmp_alias = strdup(alias);
+ char *tmp_modprobe = strdup(MODPROBE);
+ char *tmp_bq = strdup("-bq");
+ char *const argv[] = { tmp_modprobe, tmp_bq, tmp_alias, 0 };
+
+ retval = execute_command(MODPROBE, argv);
+
+ free(tmp_alias);
+ free(tmp_modprobe);
+ free(tmp_bq);
#endif
}