aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ac/ac.c
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>2001-07-24 11:36:56 +0000
committerKris Kennaway <kris@FreeBSD.org>2001-07-24 11:36:56 +0000
commitfd96447ad01f57dcd6de098b9031c65f9b4e4f7f (patch)
tree699caae626940f240e34319ccd1615c2bb4951a5 /usr.sbin/ac/ac.c
parent6979f76ff66df9c48444c26e6e777f1e33cfd762 (diff)
downloadsrc-fd96447ad01f57dcd6de098b9031c65f9b4e4f7f.tar.gz
src-fd96447ad01f57dcd6de098b9031c65f9b4e4f7f.zip
Replace strncpy -> strlcpy
Obtained from: OpenBSD MFC after: 1 week
Notes
Notes: svn path=/head/; revision=80275
Diffstat (limited to 'usr.sbin/ac/ac.c')
-rw-r--r--usr.sbin/ac/ac.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.sbin/ac/ac.c b/usr.sbin/ac/ac.c
index 3b2c39db68ba..1b3ef8c5accc 100644
--- a/usr.sbin/ac/ac.c
+++ b/usr.sbin/ac/ac.c
@@ -132,8 +132,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 */
@@ -213,8 +212,7 @@ update_user(head, name, secs)
if ((up = NEW(struct user_list)) == NULL)
errx(1, "malloc failed");
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;
@@ -429,8 +427,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
/*