chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
networkd: netdev - add missing callback when adding stacked devices
[elogind.git]
/
src
/
core
/
execute.c
diff --git
a/src/core/execute.c
b/src/core/execute.c
index af8e7c725b39120314fb91c310a50c46f9c45ab1..d8452a666c490ae0b9cda8900fcbb839edd4644a 100644
(file)
--- a/
src/core/execute.c
+++ b/
src/core/execute.c
@@
-333,7
+333,7
@@
static int setup_input(const ExecContext *context, int socket_fd, bool apply_tty
i == EXEC_INPUT_TTY_FAIL,
i == EXEC_INPUT_TTY_FORCE,
false,
i == EXEC_INPUT_TTY_FAIL,
i == EXEC_INPUT_TTY_FORCE,
false,
-
(usec_t) -1
);
+
USEC_INFINITY
);
if (fd < 0)
return fd;
if (fd < 0)
return fd;
@@
-561,7
+561,7
@@
static int restore_confirm_stdio(int *saved_stdin,
static int ask_for_confirmation(char *response, char **argv) {
int saved_stdout = -1, saved_stdin = -1, r;
static int ask_for_confirmation(char *response, char **argv) {
int saved_stdout = -1, saved_stdin = -1, r;
-
char *line
;
+
_cleanup_free_ char *line = NULL
;
r = setup_confirm_stdio(&saved_stdin, &saved_stdout);
if (r < 0)
r = setup_confirm_stdio(&saved_stdin, &saved_stdout);
if (r < 0)
@@
-571,8
+571,7
@@
static int ask_for_confirmation(char *response, char **argv) {
if (!line)
return -ENOMEM;
if (!line)
return -ENOMEM;
- r = ask(response, "yns", "Execute %s? [Yes, No, Skip] ", line);
- free(line);
+ r = ask_char(response, "yns", "Execute %s? [Yes, No, Skip] ", line);
restore_confirm_stdio(&saved_stdin, &saved_stdout);
restore_confirm_stdio(&saved_stdin, &saved_stdout);
@@
-1465,7
+1464,7
@@
int exec_spawn(ExecCommand *command,
goto fail_child;
}
goto fail_child;
}
- if (context->timer_slack_nsec !=
(nsec_t) -1
)
+ if (context->timer_slack_nsec !=
NSEC_INFINITY
)
if (prctl(PR_SET_TIMERSLACK, context->timer_slack_nsec) < 0) {
err = -errno;
r = EXIT_TIMERSLACK;
if (prctl(PR_SET_TIMERSLACK, context->timer_slack_nsec) < 0) {
err = -errno;
r = EXIT_TIMERSLACK;
@@
-1569,7
+1568,9
@@
int exec_spawn(ExecCommand *command,
!strv_isempty(context->inaccessible_dirs) ||
context->mount_flags != 0 ||
(context->private_tmp && runtime && (runtime->tmp_dir || runtime->var_tmp_dir)) ||
!strv_isempty(context->inaccessible_dirs) ||
context->mount_flags != 0 ||
(context->private_tmp && runtime && (runtime->tmp_dir || runtime->var_tmp_dir)) ||
- context->private_devices) {
+ context->private_devices ||
+ context->protect_system != PROTECT_SYSTEM_NO ||
+ context->protect_home != PROTECT_HOME_NO) {
char *tmp = NULL, *var = NULL;
char *tmp = NULL, *var = NULL;
@@
-1593,8
+1594,9
@@
int exec_spawn(ExecCommand *command,
tmp,
var,
context->private_devices,
tmp,
var,
context->private_devices,
+ context->protect_home,
+ context->protect_system,
context->mount_flags);
context->mount_flags);
-
if (err < 0) {
r = EXIT_NAMESPACE;
goto fail_child;
if (err < 0) {
r = EXIT_NAMESPACE;
goto fail_child;
@@
-1831,7
+1833,7
@@
void exec_context_init(ExecContext *c) {
c->syslog_priority = LOG_DAEMON|LOG_INFO;
c->syslog_level_prefix = true;
c->ignore_sigpipe = true;
c->syslog_priority = LOG_DAEMON|LOG_INFO;
c->syslog_level_prefix = true;
c->ignore_sigpipe = true;
- c->timer_slack_nsec =
(nsec_t) -1
;
+ c->timer_slack_nsec =
NSEC_INFINITY
;
c->personality = 0xffffffffUL;
c->runtime_directory_mode = 0755;
}
c->personality = 0xffffffffUL;
c->runtime_directory_mode = 0755;
}
@@
-2021,7
+2023,7
@@
int exec_context_load_environment(const ExecContext *c, char ***l) {
return -EINVAL;
}
for (n = 0; n < count; n++) {
return -EINVAL;
}
for (n = 0; n < count; n++) {
- k = load_env_file(pglob.gl_pathv[n], NULL, &p);
+ k = load_env_file(
NULL,
pglob.gl_pathv[n], NULL, &p);
if (k < 0) {
if (ignore)
continue;
if (k < 0) {
if (ignore)
continue;
@@
-2055,8
+2057,8
@@
int exec_context_load_environment(const ExecContext *c, char ***l) {
}
static bool tty_may_match_dev_console(const char *tty) {
}
static bool tty_may_match_dev_console(const char *tty) {
-
char *active = NULL, *console
;
-
bool b
;
+
_cleanup_free_ char *active = NULL
;
+
char *console
;
if (startswith(tty, "/dev/"))
tty += 5;
if (startswith(tty, "/dev/"))
tty += 5;
@@
-2071,10
+2073,7
@@
static bool tty_may_match_dev_console(const char *tty) {
return true;
/* "tty0" means the active VC, so it may be the same sometimes */
return true;
/* "tty0" means the active VC, so it may be the same sometimes */
- b = streq(console, tty) || (streq(console, "tty0") && tty_is_vc(tty));
- free(active);
-
- return b;
+ return streq(console, tty) || (streq(console, "tty0") && tty_is_vc(tty));
}
bool exec_context_may_touch_console(ExecContext *ec) {
}
bool exec_context_may_touch_console(ExecContext *ec) {
@@
-2111,6
+2110,8
@@
void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
"%sPrivateTmp: %s\n"
"%sPrivateNetwork: %s\n"
"%sPrivateDevices: %s\n"
"%sPrivateTmp: %s\n"
"%sPrivateNetwork: %s\n"
"%sPrivateDevices: %s\n"
+ "%sProtectHome: %s\n"
+ "%sProtectSystem: %s\n"
"%sIgnoreSIGPIPE: %s\n",
prefix, c->umask,
prefix, c->working_directory ? c->working_directory : "/",
"%sIgnoreSIGPIPE: %s\n",
prefix, c->umask,
prefix, c->working_directory ? c->working_directory : "/",
@@
-2119,6
+2120,8
@@
void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
prefix, yes_no(c->private_tmp),
prefix, yes_no(c->private_network),
prefix, yes_no(c->private_devices),
prefix, yes_no(c->private_tmp),
prefix, yes_no(c->private_network),
prefix, yes_no(c->private_devices),
+ prefix, protect_home_to_string(c->protect_home),
+ prefix, protect_system_to_string(c->protect_system),
prefix, yes_no(c->ignore_sigpipe));
STRV_FOREACH(e, c->environment)
prefix, yes_no(c->ignore_sigpipe));
STRV_FOREACH(e, c->environment)
@@
-2174,7
+2177,7
@@
void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
fputs("\n", f);
}
fputs("\n", f);
}
- if (c->timer_slack_nsec !=
(nsec_t) -1
)
+ if (c->timer_slack_nsec !=
NSEC_INFINITY
)
fprintf(f, "%sTimerSlackNSec: "NSEC_FMT "\n", prefix, c->timer_slack_nsec);
fprintf(f,
fprintf(f, "%sTimerSlackNSec: "NSEC_FMT "\n", prefix, c->timer_slack_nsec);
fprintf(f,
@@
-2460,10
+2463,10
@@
char *exec_command_line(char **argv) {
}
void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
}
void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
-
char *p2
;
+
_cleanup_free_ char *p2 = NULL
;
const char *prefix2;
const char *prefix2;
-
char *cmd
;
+
_cleanup_free_ char *cmd = NULL
;
assert(c);
assert(f);
assert(c);
assert(f);
@@
-2479,11
+2482,7
@@
void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
"%sCommand Line: %s\n",
prefix, cmd ? cmd : strerror(ENOMEM));
"%sCommand Line: %s\n",
prefix, cmd ? cmd : strerror(ENOMEM));
- free(cmd);
-
exec_status_dump(&c->exec_status, f, prefix2);
exec_status_dump(&c->exec_status, f, prefix2);
-
- free(p2);
}
void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix) {
}
void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix) {