diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-05-17 04:07:51 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-05-17 04:07:51 +0000 |
commit | 109fc98f6f36d017ec3dc2728fe3af55099a9c30 (patch) | |
tree | b8117233e9ce07b48b275e9cb8fb24c02d36e772 /usr.sbin/user | |
parent | 16c551f4d593067dadf6a4d9865588d3ab65be7c (diff) |
When modifying a group w/ no members with groupmod(8) the trailing
newline was not added. Reported by Rob Sessink, different fix by me.
Diffstat (limited to 'usr.sbin/user')
-rw-r--r-- | usr.sbin/user/user.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c index 47c845ed58b..47cddacbaea 100644 --- a/usr.sbin/user/user.c +++ b/usr.sbin/user/user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: user.c,v 1.33 2002/04/04 18:39:32 millert Exp $ */ +/* $OpenBSD: user.c,v 1.34 2002/05/17 04:07:50 millert Exp $ */ /* $NetBSD: user.c,v 1.45 2001/08/17 08:29:00 joda Exp $ */ /* @@ -1738,12 +1738,14 @@ groupmod(int argc, char **argv) if (cc >= sizeof(buf)) err(EXIT_FAILURE, "group `%s' entry too long", grp->gr_name); - if (cpp[1] == NULL) - buf[cc - 1] = '\n'; - else + if (cpp[1] != NULL) { buf[cc - 1] = ','; - buf[cc] = '\0'; + buf[cc] = '\0'; + } } + cc = strlcat(buf, "\n", sizeof(buf)); + if (cc >= sizeof(buf)) + err(EXIT_FAILURE, "group `%s' entry too long", grp->gr_name); if (!modify_gid(*argv, buf)) err(EXIT_FAILURE, "can't change %s file", _PATH_GROUP); |