diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-03-18 17:28:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 17:28:46 +0100 |
commit | dc4c1d4434ae07bdbe704423e7a18a4d582363a2 (patch) | |
tree | 109c10c7b34f9f642f667922b1cee142c41e5194 /src/systemctl | |
parent | Merge pull request #19036 from mrc0mmand/cocci-fixes (diff) | |
parent | resolved-dns-rr: drop unneeded braces (diff) | |
download | systemd-dc4c1d4434ae07bdbe704423e7a18a4d582363a2.tar.xz systemd-dc4c1d4434ae07bdbe704423e7a18a4d582363a2.zip |
Merge pull request #19030 from dtardon/rhel9-covscan
a bunch of small fixes and clenups based on initial RHEL-9 covscan run
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl-edit.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c index 7cb58c5208..314962ac69 100644 --- a/src/systemctl/systemctl-edit.c +++ b/src/systemctl/systemctl-edit.c @@ -187,10 +187,12 @@ static int create_edit_temp_file(const char *new_path, const char *original_path fprintf(f, "\n\n### %s", *path); if (!isempty(contents)) { - contents = strreplace(strstrip(contents), "\n", "\n# "); - if (!contents) + _cleanup_free_ char *commented_contents = NULL; + + commented_contents = strreplace(strstrip(contents), "\n", "\n# "); + if (!commented_contents) return log_oom(); - fprintf(f, "\n# %s", contents); + fprintf(f, "\n# %s", commented_contents); } } |