chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test-pty: silence a warning
[elogind.git]
/
src
/
core
/
execute.c
diff --git
a/src/core/execute.c
b/src/core/execute.c
index ce8b9bcb8b9b212937471b2b1ace5d8eaf44b44e..6e76bd5b504922141e6de5961fce0ae19a09a562 100644
(file)
--- a/
src/core/execute.c
+++ b/
src/core/execute.c
@@
-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);
@@
-1570,8
+1569,8
@@
int exec_spawn(ExecCommand *command,
context->mount_flags != 0 ||
(context->private_tmp && runtime && (runtime->tmp_dir || runtime->var_tmp_dir)) ||
context->private_devices ||
context->mount_flags != 0 ||
(context->private_tmp && runtime && (runtime->tmp_dir || runtime->var_tmp_dir)) ||
context->private_devices ||
- context->
read_only_system
||
- context->protect
ed_home != PROTECTED
_HOME_NO) {
+ context->
protect_system != PROTECT_SYSTEM_NO
||
+ context->protect
_home != PROTECT
_HOME_NO) {
char *tmp = NULL, *var = NULL;
char *tmp = NULL, *var = NULL;
@@
-1595,8
+1594,8
@@
int exec_spawn(ExecCommand *command,
tmp,
var,
context->private_devices,
tmp,
var,
context->private_devices,
- context->protect
ed
_home,
- context->
read_only
_system,
+ context->protect_home,
+ context->
protect
_system,
context->mount_flags);
if (err < 0) {
r = EXIT_NAMESPACE;
context->mount_flags);
if (err < 0) {
r = EXIT_NAMESPACE;
@@
-2024,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;
@@
-2058,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;
@@
-2074,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) {
@@
-2114,8
+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"
- "%sProtect
ed
Home: %s\n"
- "%s
ReadOnly
System: %s\n"
+ "%sProtectHome: %s\n"
+ "%s
Protect
System: %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 : "/",
@@
-2124,8
+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
ed_home_to_string(c->protected
_home),
- prefix,
yes_no(c->read_only
_system),
+ 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)
@@
-2467,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);
@@
-2486,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) {