X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=util.c;h=4cb09285172108a7a2f5e91e3c67939045a0d53f;hb=c855fc4dc204f7fc78e16bdc5b43cf5e5ae8d444;hp=cc3966d84d2e73db87ed2b2fdd49c22658320d72;hpb=c5a4fe46b40ea3916df038b26fd89a5cfa4281c8;p=mtetherd diff --git a/util.c b/util.c index cc3966d..4cb0928 100644 --- a/util.c +++ b/util.c @@ -18,8 +18,9 @@ along with this program. If not, see . */ +#include #include -#include +#include #include static const char *MODULE_LIST = "/proc/modules"; @@ -35,7 +36,7 @@ gboolean mtetherd_scan_modules(const char *module) { char *line = NULL; while (!found && getline(&line, NULL, fp) != -1) { g_debug("Checking if '%s' starts with %s...", line, module); - if (strcmp(line, module, strlen(module)) == 0) { + if (g_str_has_prefix(line, module) == 0) { g_message("Found %s", module); found = TRUE; } @@ -47,16 +48,6 @@ gboolean mtetherd_scan_modules(const char *module) { } gboolean mtetherd_launch_script(const char *command[]) { -/* - const char *arg; - if (enable) { - arg = SBIN_DIR "mtetherd-usbnet-enable.sh"; - } else { - arg = SBIN_DIR "mtetherd-usbnet-disable.sh"; - } - g_debug("Launching %s", arg); - const char *command[] = { "/usr/bin/sudo", arg, NULL }; -*/ pid_t pid = fork(); if (pid == 0) { if (execv(command[0], (char **const) command) == -1) {