projects
/
deliverable
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: Use PERROR all across lttng-tools, never make it quiet
[deliverable/lttng-tools.git]
/
src
/
common
/
runas.c
diff --git
a/src/common/runas.c
b/src/common/runas.c
index 745a6d0d13643d2333ee1bfe5c8b3e4c8fe4fb3b..60e02a2bf85a4e22ff363d2a6ede3cfc1a0fd277 100644
(file)
--- a/
src/common/runas.c
+++ b/
src/common/runas.c
@@
-154,14
+154,14
@@
int child_run_as(void *_data)
if (data->gid != getegid()) {
ret = setegid(data->gid);
if (ret < 0) {
if (data->gid != getegid()) {
ret = setegid(data->gid);
if (ret < 0) {
-
perror
("setegid");
+
PERROR
("setegid");
return EXIT_FAILURE;
}
}
if (data->uid != geteuid()) {
ret = seteuid(data->uid);
if (ret < 0) {
return EXIT_FAILURE;
}
}
if (data->uid != geteuid()) {
ret = seteuid(data->uid);
if (ret < 0) {
-
perror
("seteuid");
+
PERROR
("seteuid");
return EXIT_FAILURE;
}
}
return EXIT_FAILURE;
}
}
@@
-177,7
+177,7
@@
int child_run_as(void *_data)
writelen = write(data->retval_pipe, &sendret.c[index],
writeleft);
if (writelen < 0) {
writelen = write(data->retval_pipe, &sendret.c[index],
writeleft);
if (writelen < 0) {
-
perror
("write");
+
PERROR
("write");
return EXIT_FAILURE;
}
writeleft -= writelen;
return EXIT_FAILURE;
}
writeleft -= writelen;
@@
-214,7
+214,7
@@
int run_as(int (*cmd)(void *data), void *data, uid_t uid, gid_t gid)
ret = pipe(retval_pipe);
if (ret < 0) {
ret = pipe(retval_pipe);
if (ret < 0) {
-
perror
("pipe");
+
PERROR
("pipe");
retval.i = ret;
goto end;
}
retval.i = ret;
goto end;
}
@@
-228,7
+228,7
@@
int run_as(int (*cmd)(void *data), void *data, uid_t uid, gid_t gid)
MAP_PRIVATE | MAP_GROWSDOWN | MAP_ANONYMOUS | MAP_STACK,
-1, 0);
if (child_stack == MAP_FAILED) {
MAP_PRIVATE | MAP_GROWSDOWN | MAP_ANONYMOUS | MAP_STACK,
-1, 0);
if (child_stack == MAP_FAILED) {
-
perror
("mmap");
+
PERROR
("mmap");
retval.i = -ENOMEM;
goto close_pipe;
}
retval.i = -ENOMEM;
goto close_pipe;
}
@@
-240,7
+240,7
@@
int run_as(int (*cmd)(void *data), void *data, uid_t uid, gid_t gid)
CLONE_FILES | SIGCHLD,
&run_as_data, NULL);
if (pid < 0) {
CLONE_FILES | SIGCHLD,
&run_as_data, NULL);
if (pid < 0) {
-
perror
("clone");
+
PERROR
("clone");
retval.i = pid;
goto unmap_stack;
}
retval.i = pid;
goto unmap_stack;
}
@@
-250,7
+250,7
@@
int run_as(int (*cmd)(void *data), void *data, uid_t uid, gid_t gid)
do {
readlen = read(retval_pipe[0], &retval.c[index], readleft);
if (readlen < 0) {
do {
readlen = read(retval_pipe[0], &retval.c[index], readleft);
if (readlen < 0) {
-
perror
("read");
+
PERROR
("read");
ret = -1;
break;
}
ret = -1;
break;
}
@@
-264,18
+264,24
@@
int run_as(int (*cmd)(void *data), void *data, uid_t uid, gid_t gid)
*/
pid = waitpid(pid, &status, 0);
if (pid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
*/
pid = waitpid(pid, &status, 0);
if (pid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
-
perror
("wait");
+
PERROR
("wait");
retval.i = -1;
}
unmap_stack:
ret = munmap(child_stack, RUNAS_CHILD_STACK_SIZE);
if (ret < 0) {
retval.i = -1;
}
unmap_stack:
ret = munmap(child_stack, RUNAS_CHILD_STACK_SIZE);
if (ret < 0) {
-
perror
("munmap");
+
PERROR
("munmap");
retval.i = ret;
}
close_pipe:
retval.i = ret;
}
close_pipe:
- close(retval_pipe[0]);
- close(retval_pipe[1]);
+ ret = close(retval_pipe[0]);
+ if (ret) {
+ PERROR("close");
+ }
+ ret = close(retval_pipe[1]);
+ if (ret) {
+ PERROR("close");
+ }
end:
return retval.i;
}
end:
return retval.i;
}
This page took
0.025571 seconds
and
5
git commands to generate.