summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--login-utils/chfn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/login-utils/chfn.c b/login-utils/chfn.c
index a2e6e099e..b7395552b 100644
--- a/login-utils/chfn.c
+++ b/login-utils/chfn.c
@@ -376,7 +376,7 @@ static int save_new_data(struct chfn_control *ctl)
ctl->newf.other);
/* remove trailing empty fields (but not subfields of ctl->newf.other) */
- if (!ctl->newf.other) {
+ if (!ctl->newf.other || !*ctl->newf.other) {
while (len > 0 && gecos[len - 1] == ',')
len--;
gecos[len] = 0;