name[sizeof(name)-1] = '\0';
name[UT_NAMESIZE] = '\0';
notify(struct utmp *utp, off_t offset){	FILE *tp;	struct stat stb;	struct termios ttybuf;	char tty[MAXPATHLEN], name[UT_NAMESIZE + 1];	(void)snprintf(tty, sizeof(tty), "%s%.*s",	    _PATH_DEV, (int)sizeof(utp->ut_line), utp->ut_line);	if (strchr(tty + sizeof(_PATH_DEV) - 1, '/')) {		/* A slash is an attempt to break security... */		syslog(LOG_AUTH | LOG_NOTICE, "'/' in \"%s\"", tty);		return;	}	if (stat(tty, &stb) || !(stb.st_mode & S_IEXEC)) {		dsyslog(LOG_DEBUG, "%.*s: wrong mode on %s",		    (int)sizeof(utp->ut_name), utp->ut_name, tty);		return;	}	dsyslog(LOG_DEBUG, "notify %.*s on %s", (int)sizeof(utp->ut_name),	    utp->ut_name, tty);	if (fork())		return;	(void)signal(SIGALRM, SIG_DFL);	(void)alarm((u_int)30);	if ((tp = fopen(tty, "w")) == NULL) {		dsyslog(LOG_ERR, "%s: %s", tty, strerror(errno));		_exit(1);	}	(void)tcgetattr(fileno(tp), &ttybuf);	cr = (ttybuf.c_oflag & ONLCR) && (ttybuf.c_oflag & OPOST) ?	    "\n" : "\n\r";	memcpy(name, utp->ut_name, UT_NAMESIZE);	name[sizeof(name)-1] = '\0';	(void)fprintf(tp, "%s\007New mail for %s@%.*s\007 has arrived:%s----%s",	    cr, name, (int)sizeof(hostname), hostname, cr, cr);	jkfprintf(tp, name, offset);	(void)fclose(tp);	_exit(0);}