X-Git-Url: http://git.maemo.org/git/?p=browser-switch;a=blobdiff_plain;f=launcher.c;h=f229469740bf506fd8ae1e046a3a8ad7da8f0dcd;hp=67598139b9c78f9f3dc52e04cf1f3ce93687b5ce;hb=614054f597f0fc8aa2d051d6e56ece63251b9608;hpb=8aa7920c7abe393c89180034875a72a1a14a8d3d diff --git a/launcher.c b/launcher.c index 6759813..f229469 100644 --- a/launcher.c +++ b/launcher.c @@ -26,12 +26,14 @@ #include #include #include -#include -#include #include #ifdef FREMANTLE +#include +#include #include +#include +#include #endif #include "browser-switchboard.h" @@ -105,20 +107,6 @@ static DBusHandlerResult check_microb_finished(DBusConnection *connection, } #endif -/* Close stdin/stdout/stderr and replace with /dev/null */ -static int close_stdio(void) { - int fd; - - if ((fd = open("/dev/null", O_RDWR)) == -1) - return -1; - - if (dup2(fd, 0) == -1 || dup2(fd, 1) == -1 || dup2(fd, 2) == -1) - return -1; - - close(fd); - return 0; -} - static void launch_tear(struct swb_context *ctx, char *uri) { int status; static DBusGProxy *tear_proxy = NULL; @@ -155,7 +143,6 @@ static void launch_tear(struct swb_context *ctx, char *uri) { } /* Child process */ setsid(); - close_stdio(); } execl("/usr/bin/tear", "/usr/bin/tear", uri, (char *)NULL); } @@ -179,13 +166,13 @@ void launch_microb(struct swb_context *ctx, char *uri) { printf("launch_microb with uri '%s'\n", uri); /* Launch browserd if it's not running */ - status = system("pidof browserd > /dev/null"); + status = system("pidof /usr/sbin/browserd > /dev/null"); if (WIFEXITED(status) && WEXITSTATUS(status)) { kill_browserd = 1; #ifdef FREMANTLE - system("/usr/sbin/browserd -d -b > /dev/null 2>&1"); + system("/usr/sbin/browserd -d -b"); #else - system("/usr/sbin/browserd -d > /dev/null 2>&1"); + system("/usr/sbin/browserd -d"); #endif } @@ -375,8 +362,6 @@ void launch_microb(struct swb_context *ctx, char *uri) { g_object_unref(g_proxy); } else { /* Child process */ - close_stdio(); - /* exec maemo-invoker directly instead of relying on the /usr/bin/browser symlink, since /usr/bin/browser may have been replaced with a shell script calling us via D-Bus */ @@ -391,8 +376,6 @@ void launch_microb(struct swb_context *ctx, char *uri) { waitpid(pid, &status, 0); } else { /* Child process */ - close_stdio(); - /* exec maemo-invoker directly instead of relying on the /usr/bin/browser symlink, since /usr/bin/browser may have been replaced with a shell script calling us via D-Bus */ @@ -408,7 +391,7 @@ void launch_microb(struct swb_context *ctx, char *uri) { /* Kill off browserd if we started it */ if (kill_browserd) - system("kill `pidof browserd`"); + system("kill `pidof /usr/sbin/browserd`"); if (!ctx || !ctx->continuous_mode) exit(0); @@ -488,7 +471,6 @@ static void launch_other_browser(struct swb_context *ctx, char *uri) { } /* Child process */ setsid(); - close_stdio(); } execl("/bin/sh", "/bin/sh", "-c", command, (char *)NULL); }