Index: head/libexec/getty/Makefile =================================================================== --- head/libexec/getty/Makefile +++ head/libexec/getty/Makefile @@ -6,7 +6,7 @@ LIBADD= util MAN= gettytab.5 ttys.5 getty.8 -WARNS?= 1 +WARNS?= 6 WFORMAT=0 .include Index: head/libexec/getty/chat.c =================================================================== --- head/libexec/getty/chat.c +++ head/libexec/getty/chat.c @@ -62,7 +62,7 @@ static int getdigit(unsigned char **, int, int); static char **read_chat(char **); static char *cleanchr(char **, unsigned char); -static char *cleanstr(const unsigned char *, int); +static const char *cleanstr(const unsigned char *, int); static const char *result(int); static int chat_expect(const char *); static int chat_send(char const *); @@ -270,7 +270,7 @@ * clean a string for display (ctrl/meta characters) */ -static char * +static const char * cleanstr(const unsigned char *s, int l) { static unsigned char * tmp = NULL; @@ -281,7 +281,7 @@ if (tmp == NULL) { tmplen = 0; - return (char *)"(mem alloc error)"; + return "(mem alloc error)"; } else { int i = 0; char * p = tmp; Index: head/libexec/getty/main.c =================================================================== --- head/libexec/getty/main.c +++ head/libexec/getty/main.c @@ -252,14 +252,15 @@ } if (AC) { - int i, rfds; + fd_set rfds; struct timeval to; + int i; - rfds = 1 << 0; /* FD_SET */ + FD_ZERO(&rfds); + FD_SET(0, &rfds); to.tv_sec = RT; to.tv_usec = 0; - i = select(32, (fd_set*)&rfds, (fd_set*)NULL, - (fd_set*)NULL, RT ? &to : NULL); + i = select(32, &rfds, NULL, NULL, RT ? &to : NULL); if (i < 0) { syslog(LOG_ERR, "select %s: %m", ttyn); } else if (i == 0) { @@ -708,7 +709,7 @@ static char * get_line(int fd) { - int i = 0; + size_t i = 0; static char linebuf[512]; /* Index: head/libexec/getty/subr.c =================================================================== --- head/libexec/getty/subr.c +++ head/libexec/getty/subr.c @@ -68,12 +68,13 @@ long n; int l; char *p; - char *msg = NULL; - const char *dba[2]; + static char path_gettytab[PATH_MAX]; + char *dba[2]; static int firsttime = 1; - dba[0] = _PATH_GETTYTAB; + strlcpy(path_gettytab, _PATH_GETTYTAB, sizeof(path_gettytab)); + dba[0] = path_gettytab; dba[1] = NULL; if (firsttime) { @@ -101,27 +102,23 @@ firsttime = 0; } - switch (cgetent(&buf, (char **)dba, name)) { + switch (cgetent(&buf, dba, name)) { case 1: - msg = "%s: couldn't resolve 'tc=' in gettytab '%s'"; + syslog(LOG_ERR, "getty: couldn't resolve 'tc=' in gettytab '%s'", name); + return; case 0: break; case -1: - msg = "%s: unknown gettytab entry '%s'"; - break; + syslog(LOG_ERR, "getty: unknown gettytab entry '%s'", name); + return; case -2: - msg = "%s: retrieving gettytab entry '%s': %m"; - break; + syslog(LOG_ERR, "getty: retrieving gettytab entry '%s': %m", name); + return; case -3: - msg = "%s: recursive 'tc=' reference gettytab entry '%s'"; - break; + syslog(LOG_ERR, "getty: recursive 'tc=' reference gettytab entry '%s'", name); + return; default: - msg = "%s: unexpected cgetent() error for entry '%s'"; - break; - } - - if (msg != NULL) { - syslog(LOG_ERR, msg, "getty", name); + syslog(LOG_ERR, "getty: unexpected cgetent() error for entry '%s'", name); return; }