projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make mp3_get_file_info() static.
[paraslash.git]
/
exec.c
diff --git
a/exec.c
b/exec.c
index bbf1b41addf8aab65363065c9e3b6ad91cae4968..86362c381fd8b3fe236caeddd4facec88130c901 100644
(file)
--- a/
exec.c
+++ b/
exec.c
@@
-5,10
+5,12
@@
*/
/** \file exec.c Helper functions for spawning new processes. */
*/
/** \file exec.c Helper functions for spawning new processes. */
+#include <dirent.h>
#include "para.h"
#include "close_on_fork.h"
#include "error.h"
#include "string.h"
#include "para.h"
#include "close_on_fork.h"
#include "error.h"
#include "string.h"
+#include "fd.h"
/**
* Spawn a new process and redirect fd 0, 1, and 2.
/**
* Spawn a new process and redirect fd 0, 1, and 2.
@@
-35,15
+37,18
@@
static int para_exec(pid_t *pid, const char *file, char *const *const args, int
if (fds[2] > 0 && pipe(err) < 0)
goto err_out;
if (!fds[0] || !fds[1] || !fds[2]) {
if (fds[2] > 0 && pipe(err) < 0)
goto err_out;
if (!fds[0] || !fds[1] || !fds[2]) {
- ret = -E_NULL_OPEN;
- null = open("/dev/null", O_RDONLY);
- if (null < 0)
+ ret = para_open("/dev/null", O_RDONLY, 42);
+ if (ret < 0)
goto err_out;
goto err_out;
+ null = ret;
}
}
- if ((*pid = fork()) < 0)
- exit(EXIT_FAILURE);
+ ret = fork();
+ if (ret < 0) {
+ ret = -ERRNO_TO_PARA_ERROR(errno);
+ goto err_out;
+ }
+ *pid = ret;
if (!(*pid)) { /* child */
if (!(*pid)) { /* child */
- close_listed_fds(); /* close unneeded fds */
if (fds[0] >= 0) {
if (fds[0]) {
close(in[1]);
if (fds[0] >= 0) {
if (fds[0]) {
close(in[1]);
@@
-103,6
+108,7
@@
err_out:
close(in[1]);
if (null >= 0)
close(null);
close(in[1]);
if (null >= 0)
close(null);
+ PARA_ERROR_LOG("%s\n", para_strerror(-ret));
return ret;
}
return ret;
}