Blame SOURCES/0031-chfn-don-t-append-extra-tailing-commas.patch

fe1ca8
From 90d4faece26c328c40336a0e02b875515c503e30 Mon Sep 17 00:00:00 2001
fe1ca8
From: Karel Zak <kzak@redhat.com>
fe1ca8
Date: Mon, 19 Aug 2019 14:03:07 +0200
fe1ca8
Subject: [PATCH 31/32] chfn: don't append extra tailing commas
fe1ca8
fe1ca8
 # grep kzak /etc/passwd
fe1ca8
 kzak:x:1000:1000::/home/kzak:/bin/bash
fe1ca8
fe1ca8
 # chfn kzak
fe1ca8
 ...
fe1ca8
 grep kzak /etc/passwd
fe1ca8
fe1ca8
old version:
fe1ca8
 kzak:x:1000:1000:Karel Zak,,,,:/home/kzak:/bin/bash
fe1ca8
fe1ca8
fixed version:
fe1ca8
 kzak:x:1000:1000:Karel Zak:/home/kzak:/bin/bash
fe1ca8
fe1ca8
Reported-by: Filip Dvorak <fdvorak@redhat.com>
fe1ca8
References: f723cbf544a7eac2927634f2cb6d802437a2d519
fe1ca8
Upstream: http://github.com/karelzak/util-linux/commit/9210c0d225fd808da451d86055bf243a8b47a525
fe1ca8
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1743555
fe1ca8
Signed-off-by: Karel Zak <kzak@redhat.com>
fe1ca8
---
fe1ca8
 login-utils/chfn.c | 2 +-
fe1ca8
 1 file changed, 1 insertion(+), 1 deletion(-)
fe1ca8
fe1ca8
diff --git a/login-utils/chfn.c b/login-utils/chfn.c
fe1ca8
index c5312fa0c..4f32604c5 100644
fe1ca8
--- a/login-utils/chfn.c
fe1ca8
+++ b/login-utils/chfn.c
fe1ca8
@@ -377,7 +377,7 @@ static int save_new_data(struct chfn_control *ctl)
fe1ca8
 			ctl->newf.other);
fe1ca8
 
fe1ca8
 	/* remove trailing empty fields (but not subfields of ctl->newf.other) */
fe1ca8
-	if (!ctl->newf.other) {
fe1ca8
+	if (!ctl->newf.other || !*ctl->newf.other) {
fe1ca8
 		while (len > 0 && gecos[len - 1] == ',')
fe1ca8
 			len--;
fe1ca8
 		gecos[len] = 0;
fe1ca8
-- 
fe1ca8
2.21.0
fe1ca8