summaryrefslogtreecommitdiff
path: root/usr.sbin/ac/ac.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-05 07:12:51 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-05 07:12:51 +0000
commit1cc5680d6effb4ba8f40118166350e9f05b65ae5 (patch)
treef7fa0002dee6aaaae84ea1181ee9f1a583c688b8 /usr.sbin/ac/ac.c
parentac1a009b16465660d22dcda957242a5820c9f74e (diff)
use strlcpy vs strncpy+a[n-1]='\0'
Diffstat (limited to 'usr.sbin/ac/ac.c')
-rw-r--r--usr.sbin/ac/ac.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/ac/ac.c b/usr.sbin/ac/ac.c
index 1a57109acbb..cd166a73b45 100644
--- a/usr.sbin/ac/ac.c
+++ b/usr.sbin/ac/ac.c
@@ -14,7 +14,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: ac.c,v 1.7 1997/10/09 15:07:17 deraadt Exp $";
+static char rcsid[] = "$Id: ac.c,v 1.8 2001/05/05 07:12:50 mickey Exp $";
#endif
#include <sys/types.h>
@@ -129,8 +129,7 @@ add_tty(name)
tp->ret = 0;
name++;
}
- (void)strncpy(tp->name, name, sizeof (tp->name) - 1);
- tp->name[sizeof (tp->name) - 1] = '\0';
+ strlcpy(tp->name, name, sizeof (tp->name));
if ((rcp = strchr(tp->name, '*')) != NULL) { /* wild card */
*rcp = '\0';
tp->len = strlen(tp->name); /* match len bytes only */
@@ -210,8 +209,7 @@ update_user(head, name, secs)
if ((up = NEW(struct user_list)) == NULL)
err(1, "malloc");
up->next = head;
- (void)strncpy(up->name, name, sizeof (up->name) - 1);
- up->name[sizeof (up->name) - 1] = '\0'; /* paranoid! */
+ strlcpy(up->name, name, sizeof (up->name));
up->secs = secs;
Total += secs;
return up;
@@ -420,8 +418,7 @@ log_in(head, up)
/*
* this allows us to pick the right logout
*/
- (void)strncpy(up->ut_line, Console, sizeof (up->ut_line) - 1);
- up->ut_line[sizeof (up->ut_line) - 1] = '\0'; /* paranoid! */
+ strlcpy(up->ut_line, Console, sizeof (up->ut_line));
}
#endif
/*