From 870b63f0602922c0f135d3982f1febfe2706c243 Mon Sep 17 00:00:00 2001 From: Steven Luo Date: Sun, 14 Feb 2010 17:28:54 -0800 Subject: [PATCH] Install the inotify watch for lockfile creation before forking This avoids the silliness of doing this in both the parent and child process. --- launcher.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/launcher.c b/launcher.c index 819977e..0e48d42 100644 --- a/launcher.c +++ b/launcher.c @@ -204,10 +204,6 @@ void launch_microb(struct swb_context *ctx, char *uri) { /* Release the osso_browser D-Bus name so that MicroB can take it */ dbus_release_osso_browser_name(ctx); - if ((pid = fork()) == -1) { - perror("fork"); - exit(1); - } #ifdef FREMANTLE /* Put together the path to the MicroB browserd lockfile */ if (!(homedir = getenv("HOME"))) @@ -243,6 +239,11 @@ void launch_microb(struct swb_context *ctx, char *uri) { } free(microb_profile_dir); + if ((pid = fork()) == -1) { + perror("fork"); + exit(1); + } + if (pid > 0) { /* Parent process */ /* Wait for our child to start the browser UI process and @@ -477,6 +478,11 @@ void launch_microb(struct swb_context *ctx, char *uri) { execl("/usr/bin/maemo-invoker", "browser", (char *)NULL); } #else /* !FREMANTLE */ + if ((pid = fork()) == -1) { + perror("fork"); + exit(1); + } + if (pid > 0) { /* Parent process */ waitpid(pid, &status, 0); -- 1.7.9.5