log_d("now running as user %s (%d)", name, u);
log_d("now running as uid %d (%s)", u, name);
static int become_user(const char *name){	int rv;	struct passwd *pw;	uid_t u;	if (name == 0) {		log_d("become_user: name may not be null");		return -1;	}	pw = getpwnam(name);	if (pw == 0) {		log_d("%s: no such user", name);		return -1;	}	u = pw->pw_uid;	if (u == 0) {		log_d("%s: invalid user (uid 0)", name);		return -1;	}	rv = initgroups(name, pw->pw_gid);	if (debug)		log_d("become_user: initgroups(\"%s\", %d) = %d", name, pw->pw_gid, rv);	if (rv == -1) {		lerror("initgroups");		return -1;	}	rv = setgid(pw->pw_gid);	if (debug)		log_d("become_user: setgid(%d) = %d", pw->pw_gid, rv);	if (rv == -1) {		lerror("setgid");		return -1;	}	rv = setuid(u);	if (debug)		log_d("become_user: setuid(%d) = %d", u, rv);	if (rv == -1) {		lerror("setuid");		return -1;	}	log_d("now running as user %s (%d)", name, u);	return 0;}