mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
main: handle execv failure
Log an error, exit daemon
This commit is contained in:
parent
ffbb74c4af
commit
aa36a72427
3 changed files with 13 additions and 4 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <pipewire/impl.h>
|
||||
|
||||
|
|
@ -216,16 +217,23 @@ no_mem:
|
|||
static int
|
||||
execute_command_exec(struct pw_command *command, struct pw_context *context, char **err)
|
||||
{
|
||||
int pid;
|
||||
int pid, res;
|
||||
|
||||
pid = fork();
|
||||
|
||||
if (pid == 0) {
|
||||
pw_log_info("exec %s", command->args[1]);
|
||||
execv(command->args[1], command->args);
|
||||
res = execv(command->args[1], command->args);
|
||||
if (res == -1) {
|
||||
res = -errno;
|
||||
asprintf(err, "'%s': %m", command->args[1]);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pw_log_info("exec got pid %d", pid);
|
||||
int status;
|
||||
res = waitpid(pid, &status, WNOHANG);
|
||||
pw_log_info("exec got pid %d res:%d status:%d", pid, res, status);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue