svn commit: r244780 - head/lib/libutil

Baptiste Daroussin bapt at FreeBSD.org
Fri Dec 28 20:44:11 UTC 2012


Author: bapt
Date: Fri Dec 28 20:44:10 2012
New Revision: 244780
URL: http://svnweb.freebsd.org/changeset/base/244780

Log:
  Simplify pointing dst after the end of all the gr_mem pointers in newgr
  
  Submitted by:	pjd
  Reviewed by:	db

Modified:
  head/lib/libutil/gr_util.c

Modified: head/lib/libutil/gr_util.c
==============================================================================
--- head/lib/libutil/gr_util.c	Fri Dec 28 20:30:04 2012	(r244779)
+++ head/lib/libutil/gr_util.c	Fri Dec 28 20:44:10 2012	(r244780)
@@ -456,8 +456,7 @@ gr_dup(const struct group *gr)
 	else
 		newgr->gr_mem = NULL;
 	/* point dst after the end of all the gr_mem pointers in newgr */
-	dst = (char *)newgr + sizeof(struct group) +
-	    (num_mem + 1) * sizeof(*gr->gr_mem);
+	dst = (char *)&newgr->gr_mem[num_mem + 1];
 	if (gr->gr_name != NULL) {
 		newgr->gr_name = dst;
 		dst = stpcpy(dst, gr->gr_name) + 1;


More information about the svn-src-all mailing list