aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux/helper.c')
-rw-r--r--arch/um/os-Linux/helper.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index 6987d1d247a2..cd15b9df5b5c 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -42,7 +42,7 @@ static int helper_child(void *arg)
42 if(data->pre_exec != NULL) 42 if(data->pre_exec != NULL)
43 (*data->pre_exec)(data->pre_data); 43 (*data->pre_exec)(data->pre_data);
44 execvp(argv[0], argv); 44 execvp(argv[0], argv);
45 errval = errno; 45 errval = -errno;
46 printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno); 46 printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno);
47 os_write_file(data->fd, &errval, sizeof(errval)); 47 os_write_file(data->fd, &errval, sizeof(errval));
48 kill(os_getpid(), SIGKILL); 48 kill(os_getpid(), SIGKILL);
@@ -62,7 +62,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
62 stack = *stack_out; 62 stack = *stack_out;
63 else stack = alloc_stack(0, __cant_sleep()); 63 else stack = alloc_stack(0, __cant_sleep());
64 if(stack == 0) 64 if(stack == 0)
65 return(-ENOMEM); 65 return -ENOMEM;
66 66
67 ret = os_pipe(fds, 1, 0); 67 ret = os_pipe(fds, 1, 0);
68 if(ret < 0){ 68 if(ret < 0){
@@ -95,16 +95,16 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
95 /* Read the errno value from the child, if the exec failed, or get 0 if 95 /* Read the errno value from the child, if the exec failed, or get 0 if
96 * the exec succeeded because the pipe fd was set as close-on-exec. */ 96 * the exec succeeded because the pipe fd was set as close-on-exec. */
97 n = os_read_file(fds[0], &ret, sizeof(ret)); 97 n = os_read_file(fds[0], &ret, sizeof(ret));
98 if (n < 0) { 98 if(n == 0)
99 printk("run_helper : read on pipe failed, ret = %d\n", -n);
100 ret = n;
101 kill(pid, SIGKILL);
102 CATCH_EINTR(waitpid(pid, NULL, 0));
103 } else if(n != 0){
104 CATCH_EINTR(n = waitpid(pid, NULL, 0));
105 ret = -errno;
106 } else {
107 ret = pid; 99 ret = pid;
100 else {
101 if(n < 0){
102 printk("run_helper : read on pipe failed, ret = %d\n",
103 -n);
104 ret = n;
105 kill(pid, SIGKILL);
106 }
107 CATCH_EINTR(waitpid(pid, NULL, 0));
108 } 108 }
109 109
110out_close: 110out_close: