mirror of
https://github.com/systemd/systemd
synced 2024-10-15 12:34:37 +00:00
Merge pull request #10440 from poettering/fflush-and-check-some-more
use fflush_and_check() and free_and_replace() where we can
This commit is contained in:
commit
67f5d31b45
|
@ -268,8 +268,8 @@ static int gather_environment_generate(int fd, void *arg) {
|
|||
}
|
||||
|
||||
static int gather_environment_collect(int fd, void *arg) {
|
||||
char ***env = arg;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
char ***env = arg;
|
||||
int r;
|
||||
|
||||
/* Write out a series of env=cescape(VAR=value) assignments to fd. */
|
||||
|
@ -286,8 +286,9 @@ static int gather_environment_collect(int fd, void *arg) {
|
|||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (ferror(f))
|
||||
return errno > 0 ? -errno : -EIO;
|
||||
r = fflush_and_check(f);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2612,10 +2612,10 @@ static int service_deserialize_exec_command(Unit *u, const char *key, const char
|
|||
_cleanup_free_ char *arg = NULL;
|
||||
|
||||
r = extract_first_word(&value, &arg, NULL, EXTRACT_CUNESCAPE);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
break;
|
||||
else if (r < 0)
|
||||
return r;
|
||||
|
||||
switch (state) {
|
||||
case STATE_EXEC_COMMAND_TYPE:
|
||||
|
@ -2755,10 +2755,8 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
|
|||
r = cunescape(value, 0, &t);
|
||||
if (r < 0)
|
||||
log_unit_debug_errno(u, r, "Failed to unescape status text: %s", value);
|
||||
else {
|
||||
free(s->status_text);
|
||||
s->status_text = t;
|
||||
}
|
||||
else
|
||||
free_and_replace(s->status_text, t);
|
||||
|
||||
} else if (streq(key, "accept-socket")) {
|
||||
Unit *socket;
|
||||
|
|
Loading…
Reference in a new issue