Commit dd562e1a authored by Jan Rybar's avatar Jan Rybar

sysctl: Zero returned even if param setting failed

Real usecase:
'sysctl -w user.max_uts_namespaces=2147483648; echo $?'
returns 0 even though it failed with EINVAL
parent 2e7f3870
Pipeline #55737152 passed with stage
in 1 minute and 37 seconds
......@@ -463,8 +463,10 @@ static int WriteSetting(const char *setting)
rc = fprintf(fp, "%s\n", value);
if (0 < rc)
rc = 0;
if (close_stream(fp) != 0)
if (close_stream(fp) != 0) {
xwarn(_("setting key \"%s\""), outname);
rc = -1;
}
else if (rc == 0 && !Quiet) {
if (NameOnly) {
fprintf(stdout, "%s\n", outname);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment