diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c index 6d3300579ad1..ca64541d80ed 100644 --- a/libexec/talkd/announce.c +++ b/libexec/talkd/announce.c @@ -74,14 +74,13 @@ int announce(CTL_MSG *request, const char *remote_machine) { char full_tty[32]; - FILE *tf; struct stat stbuf; (void)snprintf(full_tty, sizeof(full_tty), "%s%s", _PATH_DEV, request->r_tty); if (stat(full_tty, &stbuf) < 0 || (stbuf.st_mode&020) == 0) return (PERMISSION_DENIED); - return (print_mesg(request->r_tty, tf, request, remote_machine)); + return (print_mesg(request->r_tty, request, remote_machine)); } #define max(a,b) ( (a) > (b) ? (a) : (b) ) @@ -95,13 +94,12 @@ announce(CTL_MSG *request, const char *remote_machine) * in in vi at the time */ int -print_mesg(const char *tty, FILE *tf, CTL_MSG *request, +print_mesg(const char *tty, CTL_MSG *request, const char *remote_machine) { - struct timeval clock; + struct timeval now; time_t clock_sec; struct timezone zone; - struct tm *localtime(); struct tm *localclock; struct iovec iovec; char line_buf[N_LINES][N_CHARS]; @@ -112,8 +110,8 @@ print_mesg(const char *tty, FILE *tf, CTL_MSG *request, i = 0; max_size = 0; - gettimeofday(&clock, &zone); - clock_sec = clock.tv_sec; + gettimeofday(&now, &zone); + clock_sec = now.tv_sec; localclock = localtime(&clock_sec); (void)snprintf(line_buf[i], N_CHARS, " "); sizes[i] = strlen(line_buf[i]); diff --git a/libexec/talkd/extern.h b/libexec/talkd/extern.h index df4901df64dc..cb231a95d134 100644 --- a/libexec/talkd/extern.h +++ b/libexec/talkd/extern.h @@ -26,14 +26,14 @@ */ int announce(CTL_MSG *, const char *); -int delete_invite(int); +int delete_invite(u_int32_t); void do_announce(CTL_MSG *, CTL_RESPONSE *); CTL_MSG *find_match(CTL_MSG *request); CTL_MSG *find_request(CTL_MSG *request); int find_user(const char *name, char *tty); void insert_table(CTL_MSG *, CTL_RESPONSE *); int new_id(void); -int print_mesg(const char *, FILE *, CTL_MSG *, const char *); +int print_mesg(const char *, CTL_MSG *, const char *); void print_request(const char *, CTL_MSG *); void print_response(const char *, CTL_RESPONSE *); void process_request(CTL_MSG *mp, CTL_RESPONSE *rp); diff --git a/libexec/talkd/print.c b/libexec/talkd/print.c index 355910c2fe2d..6c39d8da72cc 100644 --- a/libexec/talkd/print.c +++ b/libexec/talkd/print.c @@ -50,10 +50,10 @@ static const char rcsid[] = #include "extern.h" -static char *types[] = +static const char *types[] = { "leave_invite", "look_up", "delete", "announce" }; #define NTYPES (sizeof (types) / sizeof (types[0])) -static char *answers[] = +static const char *answers[] = { "success", "not_here", "failed", "machine_unknown", "permission_denied", "unknown_request", "badversion", "badaddr", "badctladdr" }; #define NANSWERS (sizeof (answers) / sizeof (answers[0])) @@ -61,7 +61,8 @@ static char *answers[] = void print_request(const char *cp, CTL_MSG *mp) { - char tbuf[80], *tp; + const char *tp; + char tbuf[80]; if (mp->type > NTYPES) { (void)snprintf(tbuf, sizeof(tbuf), "type %d", mp->type); @@ -69,13 +70,14 @@ print_request(const char *cp, CTL_MSG *mp) } else tp = types[mp->type]; syslog(LOG_DEBUG, "%s: %s: id %lu, l_user %s, r_user %s, r_tty %s", - cp, tp, mp->id_num, mp->l_name, mp->r_name, mp->r_tty); + cp, tp, (long)mp->id_num, mp->l_name, mp->r_name, mp->r_tty); } void print_response(const char *cp, CTL_RESPONSE *rp) { - char tbuf[80], *tp, abuf[80], *ap; + const char *tp, *ap; + char tbuf[80], abuf[80]; if (rp->type > NTYPES) { (void)snprintf(tbuf, sizeof(tbuf), "type %d", rp->type); diff --git a/libexec/talkd/table.c b/libexec/talkd/table.c index 28e8d8ef411c..001e7d41db7a 100644 --- a/libexec/talkd/table.c +++ b/libexec/talkd/table.c @@ -50,6 +50,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -198,7 +199,7 @@ new_id(void) * Delete the invitation with id 'id_num' */ int -delete_invite(int id_num) +delete_invite(u_int32_t id_num) { TABLE_ENTRY *ptr; diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c index d35c0e358a0b..ae2c6eb05f3e 100644 --- a/libexec/talkd/talkd.c +++ b/libexec/talkd/talkd.c @@ -54,6 +54,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include