File bsc1209122-a6c0795d.patch of Package procps.28824

From a6c0795d499ad6af5f80b30096cc2ad88c5d045d Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Sat, 21 Sep 2019 15:50:53 +1000
Subject: [PATCH] sysctl: ignore errors from lines starting with -

The systemd sysctl ignores errors from preload files that start
with a hyphen.  This change brings the procps sysctl into line with
their change.

References:
    procps-ng/procps#138
    https://github.com/systemd/systemd/pull/13191
    https://github.com/systemd/systemd/pull/13141
---
 sysctl.c      |   20 ++++++++++++++------
 sysctl.conf.5 |    6 +++++-
 2 files changed, 19 insertions(+), 7 deletions(-)

--- sysctl.c
+++ sysctl.c	2023-03-30 11:14:44.549525272 +0000
@@ -380,6 +380,7 @@ static int WriteSetting(const char *sett
 	char *tmpname;
 	char *outname;
 	char *last_dot;
+	bool ignore_failure;
 
 	FILE *fp;
 	struct stat ts;
@@ -404,6 +405,10 @@ static int WriteSetting(const char *sett
 		return -2;
 	}
 
+	ignore_failure = name[0] == '-';
+	if (ignore_failure)
+	    name++;
+
 	/* used to open the file */
 	tmpname = xmalloc(equals - name + 1 + strlen(PROC_PATH));
 	strcpy(tmpname, PROC_PATH);
@@ -448,19 +453,22 @@ static int WriteSetting(const char *sett
 		switch (errno) {
 		case ENOENT:
 			if (!IgnoreError) {
-				xwarnx(_("\"%s\" is an unknown key"), outname);
-				rc = -1;
+				xwarnx(_("\"%s\" is an unknown key%s"), outname, (ignore_failure?_(", ignoring"):""));
+				if (!ignore_failure)
+				    rc = -1;
 			}
 			break;
+		case EPERM:
+		case EROFS:
 		case EACCES:
-			xwarnx(_("permission denied on key '%s'"), outname);
-			rc = -1;
+			xwarnx(_("permission denied on key \"%s\"%s"), outname, (ignore_failure?_(", ignoring"):""));
 			break;
 		default:
-			xwarn(_("setting key \"%s\""), outname);
-			rc = -1;
+			xwarn(_("setting key \"%s\"%s"), outname, (ignore_failure?_(", ignoring"):""));
 			break;
 		}
+		if (!ignore_failure && errno != ENOENT)
+		    rc = -1;
 	} else {
 		rc = fprintf(fp, "%s\n", value);
 		if (0 < rc)
--- sysctl.conf.5
+++ sysctl.conf.5	2023-03-30 11:14:44.557525120 +0000
@@ -6,7 +6,7 @@
 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 .\" GNU General Public License for more details."
-.TH SYSCTL.CONF "5" "January 2012" "procps-ng" "File Formats"
+.TH SYSCTL.CONF "5" "2019-09-21" "procps-ng" "File Formats"
 .SH NAME
 sysctl.conf \- sysctl preload/configuration file
 .SH DESCRIPTION
@@ -28,6 +28,10 @@ token = value
 Note that blank lines are ignored, and whitespace before and after a token or
 value is ignored, although a value can contain whitespace within.  Lines which
 begin with a # or ; are considered comments and ignored.
+
+If a line begins with a single \-, any attempts to set the value that fail will be
+ignored.
+
 .SH NOTES
 As the
 .BR /etc/sysctl.conf
openSUSE Build Service is sponsored by