chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
10a9442
)
execute: fix terminal chowning logic
author
Lennart Poettering
<lennart@poettering.net>
Tue, 13 Apr 2010 19:13:49 +0000
(21:13 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 13 Apr 2010 19:13:49 +0000
(21:13 +0200)
execute.c
patch
|
blob
|
history
diff --git
a/execute.c
b/execute.c
index a82d016cbcaed28a05d7d804b0e077a87219d360..73d82d5a76218ac50d839ec80466b8d6fe5e80e1 100644
(file)
--- a/
execute.c
+++ b/
execute.c
@@
-342,8
+342,7
@@
static int chown_terminal(int fd, uid_t uid) {
if (fstat(fd, &st) < 0)
return -errno;
if (fstat(fd, &st) < 0)
return -errno;
- if (st.st_uid != uid ||
- st.st_mode != TTY_MODE)
+ if (st.st_uid != uid || (st.st_mode & 0777) != TTY_MODE)
return -EPERM;
return 0;
return -EPERM;
return 0;
@@
-834,6
+833,12
@@
int exec_spawn(ExecCommand *command,
r = EXIT_USER;
goto fail;
}
r = EXIT_USER;
goto fail;
}
+
+ if (is_terminal_input(context->std_input))
+ if (chown_terminal(STDIN_FILENO, uid) < 0) {
+ r = EXIT_STDIN;
+ goto fail;
+ }
}
if (apply_permissions)
}
if (apply_permissions)
@@
-842,12
+847,6
@@
int exec_spawn(ExecCommand *command,
goto fail;
}
goto fail;
}
- if (is_terminal_input(context->std_input))
- if (chown_terminal(STDIN_FILENO, uid) < 0) {
- r = EXIT_STDIN;
- goto fail;
- }
-
if (apply_chroot) {
if (context->root_directory)
if (chroot(context->root_directory) < 0) {
if (apply_chroot) {
if (context->root_directory)
if (chroot(context->root_directory) < 0) {