Changes: invoker can launch applications even without applauncherd

pull/1/head
Alexey Shilov 15 years ago
parent adcf083909
commit b240224f6e

@ -182,7 +182,8 @@ static int invoker_init(enum APP_TYPE app_type)
fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0)
{
die(1, "Failed to open invoker socket.\n");
warning("Failed to open invoker socket.\n");
return -1;
}
sun.sun_family = AF_UNIX; //AF_FILE;
@ -205,7 +206,8 @@ static int invoker_init(enum APP_TYPE app_type)
if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) < 0)
{
die(1, "Failed to initiate connect on the socket.\n");
warning("Failed to initiate connect on the socket.\n");
return -1;
}
return fd;
@ -444,6 +446,19 @@ static int invoke(int prog_argc, char **prog_argv, char *prog_name,
int fd = invoker_init(app_type);
if (fd == -1)
{
// connection with launcher is broken, try to launch application via execve
warning("Connection with launcher is broken\n");
execve(prog_name, prog_argv, environ);
perror("execve"); /* execve() only returns on error */
exit(EXIT_FAILURE);
}
else
{
// connection with launcher process is established
invoker_send_magic(fd, magic_options);
invoker_send_name(fd, prog_argv[0]);
invoker_send_exec(fd, prog_name);
@ -477,6 +492,7 @@ static int invoke(int prog_argc, char **prog_argv, char *prog_name,
close(fd);
}
}
return status;
}

Loading…
Cancel
Save