projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Only seteuid/setegid if they differ from current values
[lttng-tools.git]
/
librunas
/
runas.c
diff --git
a/librunas/runas.c
b/librunas/runas.c
index cbb70ee193469dfe35439b8735fcbdda9ebad938..1fc4116255b017ddeed25a2fa5dae414931b1e84 100644
(file)
--- a/
librunas/runas.c
+++ b/
librunas/runas.c
@@
-148,15
+148,19
@@
int child_run_as(void *_data)
* cannot attach to this process with, e.g. ptrace, nor map this
* process memory.
*/
* cannot attach to this process with, e.g. ptrace, nor map this
* process memory.
*/
- ret = setegid(data->gid);
- if (ret < 0) {
- perror("setegid");
- exit(EXIT_FAILURE);
+ if (data->gid != getegid()) {
+ ret = setegid(data->gid);
+ if (ret < 0) {
+ perror("setegid");
+ exit(EXIT_FAILURE);
+ }
}
}
- ret = seteuid(data->uid);
- if (ret < 0) {
- perror("seteuid");
- exit(EXIT_FAILURE);
+ if (data->uid != geteuid()) {
+ ret = seteuid(data->uid);
+ if (ret < 0) {
+ perror("seteuid");
+ exit(EXIT_FAILURE);
+ }
}
/*
* Also set umask to 0 for mkdir executable bit.
}
/*
* Also set umask to 0 for mkdir executable bit.
This page took
0.023267 seconds
and
4
git commands to generate.