Trim newlines when reading from sysctl
Values read from sysctl have trailing newlines, but the values we set
don't; trim the newlines before comparing to ensure we don't attempt
to write needlessly.
@@ -164,6 +164,9 @@ func setSysctl(path string, contents []byte) error {
return err
}
+ // Ignore leading and terminating newlines
+ existing = bytes.Trim(existing, "\n")
+
if bytes.Equal(existing, contents) {
return nil
}
