int rval = 0;
int rval;
setfile(fs, fd)	register struct stat *fs;	int fd;{	static struct timeval tv[2];	int rval = 0;	fs->st_mode &= S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO;	TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atimespec);	TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtimespec);	if (utimes(to.p_path, tv)) {		warn("utimes: %s", to.p_path);		rval = 1;	}	/*	 * Changing the ownership probably won't succeed, unless we're root	 * or POSIX_CHOWN_RESTRICTED is not set.  Set uid/gid before setting	 * the mode; current BSD behavior is to remove all setuid bits on	 * chown.  If chown fails, lose setuid/setgid bits.	 */	if (fd ? fchown(fd, fs->st_uid, fs->st_gid) :	    chown(to.p_path, fs->st_uid, fs->st_gid)) {		if (errno != EPERM) {			warn("chown: %s", to.p_path);			rval = 1;		}		fs->st_mode &= ~(S_ISUID | S_ISGID);	}	if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) {		warn("chmod: %s", to.p_path);		rval = 1;	}	if (fd ?	    fchflags(fd, fs->st_flags) : chflags(to.p_path, fs->st_flags)) {		warn("chflags: %s", to.p_path);		rval = 1;	}	return (rval);}