use sizeof

This commit is contained in:
tg 2009-08-01 20:31:47 +00:00
parent 68f9bfa689
commit 66b4399881

6
misc.c
View File

@ -29,7 +29,7 @@
#include <grp.h> #include <grp.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.113 2009/08/01 20:29:24 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/misc.c,v 1.114 2009/08/01 20:31:47 tg Exp $");
#undef USE_CHVT #undef USE_CHVT
/* XXX conditions correct? */ /* XXX conditions correct? */
@ -1365,9 +1365,9 @@ chvt(const char *fn)
} else { } else {
if (stat(fn, &sb)) { if (stat(fn, &sb)) {
memcpy(dv, "/dev/ttyC", 9); memcpy(dv, "/dev/ttyC", 9);
strlcpy(dv + 9, fn, 20 - 9); strlcpy(dv + 9, fn, sizeof(dv) - 9);
if (stat(dv, &sb)) { if (stat(dv, &sb)) {
strlcpy(dv + 8, fn, 20 - 8); strlcpy(dv + 8, fn, sizeof(dv) - 8);
if (stat(dv, &sb)) if (stat(dv, &sb))
errorf("chvt: can't find tty %s", fn); errorf("chvt: can't find tty %s", fn);
} }