File util-linux-agetty-smart-reload-05.patch of Package util-linux.25288

Backport.
From 980a6e431cf69107a96e1a365be43f66fd3ccb2a Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 11 Oct 2018 13:21:23 +0200
Subject: [PATCH 05/14] agetty: cleanup issue output change, remove bool

Signed-off-by: Karel Zak <kzak@redhat.com>
---
 term-utils/agetty.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

Index: util-linux-2.31.1/term-utils/agetty.c
===================================================================
--- util-linux-2.31.1.orig/term-utils/agetty.c
+++ util-linux-2.31.1/term-utils/agetty.c
@@ -28,7 +28,6 @@
 #include <utmpx.h>
 #include <getopt.h>
 #include <time.h>
-#include <stdbool.h>
 #include <sys/socket.h>
 #include <langinfo.h>
 #include <grp.h>
@@ -1679,18 +1678,17 @@ static int wait_for_term_input(int fd)
 }
 #endif  /* AGETTY_RELOAD */
 #ifdef	ISSUE
-static bool cmp_issue_file(struct issue *ie)
+static int issue_is_changed(struct issue *ie)
 {
-	if (ie->mem_old && ie->mem) {
-		if (!strcmp(ie->mem_old, ie->mem)) {
-			free(ie->mem_old);
-			ie->mem_old = ie->mem;
-			ie->mem = NULL;
-			return false;
-		}
-	} else
-		return true;
-	return true;
+	if (ie->mem_old && ie->mem
+	    && strcmp(ie->mem_old, ie->mem) == 0) {
+		free(ie->mem_old);
+		ie->mem_old = ie->mem;
+		ie->mem = NULL;
+		return 0;
+	}
+
+	return 1;
 }
 #endif
 
@@ -1746,7 +1744,7 @@ static void eval_issue_file(struct issue
 	if ((op->flags & F_ISSUE) && (fd = fopen(op->issue, "r"))) {
 		int c;
 
-		ie->do_tcsetattr = true;
+		ie->do_tcsetattr = 1;
 
 		while ((c = getc(fd)) != EOF) {
 			if (c == '\\')
@@ -1757,7 +1755,7 @@ static void eval_issue_file(struct issue
 		fflush(stdout);
 
 		if ((op->flags & F_VCONSOLE) == 0)
-			ie->do_tcrestore = true;
+			ie->do_tcrestore = 1;
 		fclose(fd);
 	}
 #ifdef AGETTY_RELOAD
@@ -1781,7 +1779,7 @@ again:
 #ifdef AGETTY_RELOAD
 		if (!wait_for_term_input(STDIN_FILENO)) {
 			eval_issue_file(ie, op, tp);
-			if (cmp_issue_file(ie)) {
+			if (issue_is_changed(ie)) {
 				if (op->flags & F_VCONSOLE)
 					termio_clear(STDOUT_FILENO);
 				goto again;
@@ -1920,7 +1918,7 @@ static char *get_logname(struct issue *i
 			if ((op->flags & F_VCONSOLE) == 0)
 				sleep(1);
 			eval_issue_file(ie, op, tp);
-			if (!cmp_issue_file(ie))
+			if (!issue_is_changed(ie))
 				goto no_reload;
 			tcflush(STDIN_FILENO, TCIFLUSH);
 			if (op->flags & F_VCONSOLE)
openSUSE Build Service is sponsored by