diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-26 00:39:29 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-26 00:39:29 +0000 |
commit | 06e33d45a328a88d70c4bef50764764e51c54895 (patch) | |
tree | d2c8be40ccad1ab4983a8371f7c3f94176167ab5 /sbin/fsck_ffs | |
parent | 00086cda041bff73b60dc5ff619ac416269d8c80 (diff) |
string cleaning; ok tedu
Diffstat (limited to 'sbin/fsck_ffs')
-rw-r--r-- | sbin/fsck_ffs/dir.c | 8 | ||||
-rw-r--r-- | sbin/fsck_ffs/extern.h | 4 | ||||
-rw-r--r-- | sbin/fsck_ffs/inode.c | 16 | ||||
-rw-r--r-- | sbin/fsck_ffs/pass2.c | 14 | ||||
-rw-r--r-- | sbin/fsck_ffs/utilities.c | 10 |
5 files changed, 27 insertions, 25 deletions
diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index 7788c9a1bb9..a24b92fed73 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.13 2002/08/23 09:09:04 gluk Exp $ */ +/* $OpenBSD: dir.c,v 1.14 2003/04/26 00:39:28 deraadt Exp $ */ /* $NetBSD: dir.c,v 1.20 1996/09/27 22:45:11 christos Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94"; #else -static const char rcsid[] = "$OpenBSD: dir.c,v 1.13 2002/08/23 09:09:04 gluk Exp $"; +static const char rcsid[] = "$OpenBSD: dir.c,v 1.14 2003/04/26 00:39:28 deraadt Exp $"; #endif #endif /* not lint */ @@ -283,7 +283,7 @@ fileerror(ino_t cwd, ino_t ino, char *errmesg) pwarn("%s ", errmesg); pinode(ino); printf("\n"); - getpathname(pathbuf, cwd, ino); + getpathname(pathbuf, sizeof pathbuf, cwd, ino); if (ino < ROOTINO || ino > maxino) { pfatal("NAME=%s\n", pathbuf); return; @@ -544,7 +544,7 @@ makeentry(ino_t parent, ino_t ino, char *name) } if ((ckinode(dp, &idesc) & ALTERED) != 0) return (1); - getpathname(pathbuf, parent, parent); + getpathname(pathbuf, sizeof pathbuf, parent, parent); dp = ginode(parent); if (expanddir(dp, pathbuf) == 0) return (0); diff --git a/sbin/fsck_ffs/extern.h b/sbin/fsck_ffs/extern.h index 5ac4e5c2672..2f971986c88 100644 --- a/sbin/fsck_ffs/extern.h +++ b/sbin/fsck_ffs/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.6 2002/02/16 21:27:34 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.7 2003/04/26 00:39:28 deraadt Exp $ */ /* $NetBSD: extern.h,v 1.6 1996/09/27 22:45:12 christos Exp $ */ /* @@ -51,7 +51,7 @@ void freeblk(daddr_t, long); void freeino(ino_t); void freeinodebuf(void); int ftypeok(struct dinode *); -void getpathname(char *, ino_t, ino_t); +void getpathname(char *, size_t, ino_t, ino_t); void inocleanup(void); void inodirty(void); int linkup(ino_t, ino_t); diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 77fd1615f77..8cb1d80b214 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inode.c,v 1.21 2002/08/23 09:09:04 gluk Exp $ */ +/* $OpenBSD: inode.c,v 1.22 2003/04/26 00:39:28 deraadt Exp $ */ /* $NetBSD: inode.c,v 1.23 1996/10/11 20:15:47 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95"; #else -static const char rcsid[] = "$OpenBSD: inode.c,v 1.21 2002/08/23 09:09:04 gluk Exp $"; +static const char rcsid[] = "$OpenBSD: inode.c,v 1.22 2003/04/26 00:39:28 deraadt Exp $"; #endif #endif /* not lint */ @@ -92,8 +92,8 @@ ckinode(struct dinode *dp, struct inodesc *idesc) if (*ap == 0) { if (idesc->id_type == DATA && ndb >= 0) { /* An empty block in a directory XXX */ - getpathname(pathbuf, idesc->id_number, - idesc->id_number); + getpathname(pathbuf, sizeof pathbuf, + idesc->id_number, idesc->id_number); pfatal("DIRECTORY %s: CONTAINS EMPTY BLOCKS", pathbuf); if (reply("ADJUST LENGTH") == 1) { @@ -128,8 +128,8 @@ ckinode(struct dinode *dp, struct inodesc *idesc) } else { if (idesc->id_type == DATA && remsize > 0) { /* An empty block in a directory XXX */ - getpathname(pathbuf, idesc->id_number, - idesc->id_number); + getpathname(pathbuf, sizeof pathbuf, + idesc->id_number, idesc->id_number); pfatal("DIRECTORY %s: CONTAINS EMPTY BLOCKS", pathbuf); if (reply("ADJUST LENGTH") == 1) { @@ -208,8 +208,8 @@ iblock(struct inodesc *idesc, long ilevel, u_int64_t isize) } else { if (idesc->id_type == DATA && isize > 0) { /* An empty block in a directory XXX */ - getpathname(pathbuf, idesc->id_number, - idesc->id_number); + getpathname(pathbuf, sizeof pathbuf, + idesc->id_number, idesc->id_number); pfatal("DIRECTORY %s: CONTAINS EMPTY BLOCKS", pathbuf); if (reply("ADJUST LENGTH") == 1) { diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c index bef32dafcd7..6bf7c368e7e 100644 --- a/sbin/fsck_ffs/pass2.c +++ b/sbin/fsck_ffs/pass2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pass2.c,v 1.15 2003/04/16 02:57:51 deraadt Exp $ */ +/* $OpenBSD: pass2.c,v 1.16 2003/04/26 00:39:28 deraadt Exp $ */ /* $NetBSD: pass2.c,v 1.17 1996/09/27 22:45:15 christos Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pass2.c 8.6 (Berkeley) 10/27/94"; #else -static const char rcsid[] = "$OpenBSD: pass2.c,v 1.15 2003/04/16 02:57:51 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: pass2.c,v 1.16 2003/04/26 00:39:28 deraadt Exp $"; #endif #endif /* not lint */ @@ -172,7 +172,8 @@ pass2(void) inodirty(); } } else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) { - getpathname(pathbuf, inp->i_number, inp->i_number); + getpathname(pathbuf, sizeof pathbuf, + inp->i_number, inp->i_number); if (usedsoftdep) pfatal("%s %s: LENGTH %ld NOT MULTIPLE of %d", "DIRECTORY", pathbuf, (long)inp->i_isize, @@ -466,9 +467,10 @@ again: case DFOUND: inp = getinoinfo(dirp->d_ino); if (inp->i_parent != 0 && idesc->id_entryno > 2) { - getpathname(pathbuf, idesc->id_number, - idesc->id_number); - getpathname(namebuf, dirp->d_ino, dirp->d_ino); + getpathname(pathbuf, sizeof pathbuf, + idesc->id_number, idesc->id_number); + getpathname(namebuf, sizeof namebuf, + dirp->d_ino, dirp->d_ino); pwarn("%s %s %s\n", pathbuf, "IS AN EXTRANEOUS HARD LINK TO DIRECTORY", namebuf); diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c index 0bf21ce3e91..922c0a8ed2f 100644 --- a/sbin/fsck_ffs/utilities.c +++ b/sbin/fsck_ffs/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.17 2002/08/23 09:09:04 gluk Exp $ */ +/* $OpenBSD: utilities.c,v 1.18 2003/04/26 00:39:28 deraadt Exp $ */ /* $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93"; #else -static const char rcsid[] = "$OpenBSD: utilities.c,v 1.17 2002/08/23 09:09:04 gluk Exp $"; +static const char rcsid[] = "$OpenBSD: utilities.c,v 1.18 2003/04/26 00:39:28 deraadt Exp $"; #endif #endif /* not lint */ @@ -417,7 +417,7 @@ freeblk(daddr_t blkno, long frags) * Find a pathname */ void -getpathname(char *namebuf, ino_t curdir, ino_t ino) +getpathname(char *namebuf, size_t namebuflen, ino_t curdir, ino_t ino) { int len; char *cp; @@ -425,12 +425,12 @@ getpathname(char *namebuf, ino_t curdir, ino_t ino) static int busy = 0; if (curdir == ino && ino == ROOTINO) { - (void)strcpy(namebuf, "/"); + (void)strlcpy(namebuf, "/", namebuflen); return; } if (busy || (statemap[curdir] != DSTATE && statemap[curdir] != DFOUND)) { - (void)strcpy(namebuf, "?"); + (void)strlcpy(namebuf, "?", namebuflen); return; } busy = 1; |