dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
/* If old is an empty string, then the name has been acquired, and
MicroB should be ready to handle our request */
if (strlen(old) == 0) {
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
/* If old is an empty string, then the name has been acquired, and
MicroB should be ready to handle our request */
if (strlen(old) == 0) {
/* We should be able to just call the D-Bus service to open Tear ...
but if Tear's not open, that cuases D-Bus to start Tear and then
/* We should be able to just call the D-Bus service to open Tear ...
but if Tear's not open, that cuases D-Bus to start Tear and then
if (!dbus_g_proxy_call(tear_proxy, "OpenAddress", &error,
G_TYPE_STRING, uri, G_TYPE_INVALID,
G_TYPE_INVALID)) {
if (!dbus_g_proxy_call(tear_proxy, "OpenAddress", &error,
G_TYPE_STRING, uri, G_TYPE_INVALID,
G_TYPE_INVALID)) {
if (ctx->continuous_mode) {
if ((pid = fork()) != 0) {
/* Parent process or error in fork() */
if (ctx->continuous_mode) {
if ((pid = fork()) != 0) {
/* Parent process or error in fork() */
homedir = DEFAULT_HOMEDIR;
len = strlen(homedir) + strlen(MICROB_PROFILE_DIR) + 1;
if (!(microb_profile_dir = calloc(len, sizeof(char)))) {
homedir = DEFAULT_HOMEDIR;
len = strlen(homedir) + strlen(MICROB_PROFILE_DIR) + 1;
if (!(microb_profile_dir = calloc(len, sizeof(char)))) {
exit(1);
}
snprintf(microb_profile_dir, len, "%s%s",
exit(1);
}
snprintf(microb_profile_dir, len, "%s%s",
len = strlen(homedir) + strlen(MICROB_PROFILE_DIR) +
strlen("/") + strlen(MICROB_LOCKFILE) + 1;
if (!(microb_lockfile = calloc(len, sizeof(char)))) {
len = strlen(homedir) + strlen(MICROB_PROFILE_DIR) +
strlen("/") + strlen(MICROB_LOCKFILE) + 1;
if (!(microb_lockfile = calloc(len, sizeof(char)))) {
exit(1);
}
snprintf(microb_lockfile, len, "%s%s/%s",
exit(1);
}
snprintf(microb_lockfile, len, "%s%s/%s",
is launched, to make sure there's no race between browserd
starting and us creating the watch */
if ((fd = inotify_init()) == -1) {
is launched, to make sure there's no race between browserd
starting and us creating the watch */
if ((fd = inotify_init()) == -1) {
"type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='com.nokia.osso_browser'",
&dbus_error);
if (dbus_error_is_set(&dbus_error)) {
"type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='com.nokia.osso_browser'",
&dbus_error);
if (dbus_error_is_set(&dbus_error)) {
filter_func = check_microb_started;
if (!dbus_connection_add_filter(raw_connection,
filter_func, NULL, NULL)) {
filter_func = check_microb_started;
if (!dbus_connection_add_filter(raw_connection,
filter_func, NULL, NULL)) {
while (!microb_started &&
dbus_connection_read_write_dispatch(raw_connection,
-1));
while (!microb_started &&
dbus_connection_read_write_dispatch(raw_connection,
-1));
"/com/nokia/osso_browser/request",
"com.nokia.osso_browser");
if (!g_proxy) {
"/com/nokia/osso_browser/request",
"com.nokia.osso_browser");
if (!g_proxy) {
memset(buf, '\0', 256);
/* read() blocks until there are events to be read */
while ((bytes_read = read(fd, buf, 255)) > 0) {
memset(buf, '\0', 256);
/* read() blocks until there are events to be read */
while ((bytes_read = read(fd, buf, 255)) > 0) {
inotify_rm_watch(fd, inot_wd);
close(fd);
/* Get the PID of the browserd from the lockfile */
if ((browserd_pid = get_browserd_pid(microb_lockfile)) <= 0) {
if (browserd_pid == 0)
inotify_rm_watch(fd, inot_wd);
close(fd);
/* Get the PID of the browserd from the lockfile */
if ((browserd_pid = get_browserd_pid(microb_lockfile)) <= 0) {
if (browserd_pid == 0)
- printf("readlink() on lockfile failed: %s\n",
- strerror(-browserd_pid));
+ log_perror(-browserd_pid,
+ "readlink() on lockfile failed");
/* Clear any existing SIGCHLD handler to prevent interference
with our wait() */
act.sa_handler = SIG_DFL;
act.sa_flags = 0;
sigemptyset(&(act.sa_mask));
if (sigaction(SIGCHLD, &act, &oldact) == -1) {
/* Clear any existing SIGCHLD handler to prevent interference
with our wait() */
act.sa_handler = SIG_DFL;
act.sa_flags = 0;
sigemptyset(&(act.sa_mask));
if (sigaction(SIGCHLD, &act, &oldact) == -1) {
exit(1);
}
/* Trace the browserd to get a close notification */
ignore_sigstop = 1;
if (ptrace(PTRACE_ATTACH, browserd_pid, NULL, NULL) == -1) {
exit(1);
}
/* Trace the browserd to get a close notification */
ignore_sigstop = 1;
if (ptrace(PTRACE_ATTACH, browserd_pid, NULL, NULL) == -1) {
exit(1);
}
ptrace(PTRACE_CONT, browserd_pid, NULL, NULL);
exit(1);
}
ptrace(PTRACE_CONT, browserd_pid, NULL, NULL);
immediately after we start tracing
the process, and won't be followed
by a SIGCONT at any point */
immediately after we start tracing
the process, and won't be followed
by a SIGCONT at any point */
browserd; if that happens before we kill the browser UI, the
newly started browserd may not close with the UI
XXX: Hope we don't cause data loss here! */
browserd; if that happens before we kill the browser UI, the
newly started browserd may not close with the UI
XXX: Hope we don't cause data loss here! */
kill(pid, SIGTERM);
waitpid(pid, &status, 0);
/* Restore old SIGCHLD handler */
if (sigaction(SIGCHLD, &oldact, NULL) == -1) {
kill(pid, SIGTERM);
waitpid(pid, &status, 0);
/* Restore old SIGCHLD handler */
if (sigaction(SIGCHLD, &oldact, NULL) == -1) {
if (!(command = calloc(cmdlen+urilen+1, sizeof(char))))
exit(1);
snprintf(command, cmdlen+urilen+1, ctx->other_browser_cmd, quoted_uri);
if (!(command = calloc(cmdlen+urilen+1, sizeof(char))))
exit(1);
snprintf(command, cmdlen+urilen+1, ctx->other_browser_cmd, quoted_uri);
free(ctx->other_browser_cmd);
ctx->other_browser_cmd = calloc(len+1, sizeof(char));
if (!ctx->other_browser_cmd) {
free(ctx->other_browser_cmd);
ctx->other_browser_cmd = calloc(len+1, sizeof(char));
if (!ctx->other_browser_cmd) {
ctx->default_browser_launcher = LAUNCH_DEFAULT_BROWSER;
} else {
ctx->other_browser_cmd = strncpy(ctx->other_browser_cmd,
ctx->default_browser_launcher = LAUNCH_DEFAULT_BROWSER;
} else {
ctx->other_browser_cmd = strncpy(ctx->other_browser_cmd,
/* Cheat and reuse launch_other_browser, since we don't appear
to need to do anything special */
use_other_browser_cmd(ctx, "fennec %s");
/* Cheat and reuse launch_other_browser, since we don't appear
to need to do anything special */
use_other_browser_cmd(ctx, "fennec %s");
else if (!strcmp(default_browser, "midori"))
use_other_browser_cmd(ctx, "midori %s");
else if (!strcmp(default_browser, "other")) {
if (ctx->other_browser_cmd)
ctx->default_browser_launcher = launch_other_browser;
else {
else if (!strcmp(default_browser, "midori"))
use_other_browser_cmd(ctx, "midori %s");
else if (!strcmp(default_browser, "other")) {
if (ctx->other_browser_cmd)
ctx->default_browser_launcher = launch_other_browser;
else {