mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
use sizeof w/ defines; niklas@ millert@ ok.
This commit is contained in:
parent
021eb6bc63
commit
3332ec1203
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: readlabel.c,v 1.5 2001/08/16 18:34:40 millert Exp $ */
|
||||
/* $OpenBSD: readlabel.c,v 1.6 2002/02/21 07:32:55 fgsch Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, Jason Downs. All rights reserved.
|
||||
@ -74,9 +74,9 @@ char *readlabelfs(device, verbose)
|
||||
rpath[strlen(rpath) - 1] = 'a' + getrawpartition();
|
||||
break;
|
||||
case S_IFBLK:
|
||||
if (strlen(device) > strlen(_PATH_DEV)) {
|
||||
if (strlen(device) > sizeo(_PATH_DEV) - 1) {
|
||||
snprintf(rpath, sizeof(rpath), "%sr%s", _PATH_DEV,
|
||||
&device[strlen(_PATH_DEV)]);
|
||||
&device[sizeof(_PATH_DEV) - 1]);
|
||||
|
||||
/* Change partition name. */
|
||||
part = rpath[strlen(rpath) - 1];
|
||||
|
@ -1074,8 +1074,8 @@ clean_ttyname (char *tty)
|
||||
{
|
||||
char *res = tty;
|
||||
|
||||
if (strncmp (res, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||
res += strlen(_PATH_DEV);
|
||||
if (strncmp (res, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
|
||||
res += sizeof(_PATH_DEV) - 1;
|
||||
if (strncmp (res, "pty/", 4) == 0)
|
||||
res += 4;
|
||||
if (strncmp (res, "ptym/", 5) == 0)
|
||||
|
@ -697,7 +697,7 @@ check_mounted(const char *fname, mode_t mode)
|
||||
|
||||
if (!(n = getmntinfo(&mp, MNT_NOWAIT)))
|
||||
err(1, "getmntinfo");
|
||||
len = strlen(_PATH_DEV);
|
||||
len = sizeof(_PATH_DEV) - 1;
|
||||
s1 = fname;
|
||||
if (!strncmp(s1, _PATH_DEV, len))
|
||||
s1 += len;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: write.c,v 1.15 2002/02/16 21:27:59 millert Exp $ */
|
||||
/* $OpenBSD: write.c,v 1.16 2002/02/21 07:32:55 fgsch Exp $ */
|
||||
/* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */
|
||||
|
||||
/*
|
||||
@ -47,7 +47,7 @@ static char copyright[] =
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95";
|
||||
#endif
|
||||
static char *rcsid = "$OpenBSD: write.c,v 1.15 2002/02/16 21:27:59 millert Exp $";
|
||||
static char *rcsid = "$OpenBSD: write.c,v 1.16 2002/02/21 07:32:55 fgsch Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -111,8 +111,8 @@ main(argc, argv)
|
||||
do_write(tty, mytty, myuid);
|
||||
break;
|
||||
case 3:
|
||||
if (!strncmp(argv[2], _PATH_DEV, strlen(_PATH_DEV)))
|
||||
argv[2] += strlen(_PATH_DEV);
|
||||
if (!strncmp(argv[2], _PATH_DEV, sizeof(_PATH_DEV) - 1))
|
||||
argv[2] += sizeof(_PATH_DEV) - 1;
|
||||
if (utmp_chk(argv[1], argv[2]))
|
||||
errx(1, "%s is not logged in on %s",
|
||||
argv[1], argv[2]);
|
||||
|
@ -16,7 +16,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $OpenBSD: physical.c,v 1.31 2001/08/19 23:22:18 brian Exp $
|
||||
* $OpenBSD: physical.c,v 1.32 2002/02/21 07:32:55 fgsch Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -593,7 +593,7 @@ iov2physical(struct datalink *dl, struct iovec *iov, int *niov, int maxiov,
|
||||
p->desc.Write = physical_DescriptorWrite;
|
||||
p->type = PHYS_DIRECT;
|
||||
p->dl = dl;
|
||||
len = strlen(_PATH_DEV);
|
||||
len = sizeof(_PATH_DEV) - 1;
|
||||
p->out = NULL;
|
||||
p->connect_count = 1;
|
||||
|
||||
@ -953,7 +953,7 @@ physical_DeleteQueue(struct physical *p)
|
||||
void
|
||||
physical_SetDevice(struct physical *p, const char *name)
|
||||
{
|
||||
int len = strlen(_PATH_DEV);
|
||||
int len = sizeof(_PATH_DEV) - 1;
|
||||
|
||||
if (name != p->name.full) {
|
||||
strncpy(p->name.full, name, sizeof p->name.full - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user