summaryrefslogtreecommitdiff
path: root/sbin/ncheck_ffs
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-12 15:26:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-12 15:26:24 +0000
commit9c9800d4aa82516083bfbda3a38f0cac4944fac5 (patch)
tree24ea2e0f8e18491bf4074d281f96f6a096522c2b /sbin/ncheck_ffs
parentabafa2e8919d40cadcded6b038d3d11944793294 (diff)
more asprintf; ok dhill@mindcry.org
Diffstat (limited to 'sbin/ncheck_ffs')
-rw-r--r--sbin/ncheck_ffs/ncheck_ffs.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sbin/ncheck_ffs/ncheck_ffs.c b/sbin/ncheck_ffs/ncheck_ffs.c
index 28d8a1b0e39..93ecf017de0 100644
--- a/sbin/ncheck_ffs/ncheck_ffs.c
+++ b/sbin/ncheck_ffs/ncheck_ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ncheck_ffs.c,v 1.24 2005/04/12 06:39:29 deraadt Exp $ */
+/* $OpenBSD: ncheck_ffs.c,v 1.25 2005/11/12 15:26:23 deraadt Exp $ */
/*-
* Copyright (c) 1995, 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
@@ -26,7 +26,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: ncheck_ffs.c,v 1.24 2005/04/12 06:39:29 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: ncheck_ffs.c,v 1.25 2005/11/12 15:26:23 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -385,18 +385,13 @@ searchdir(ino_t ino, daddr_t blkno, long size, long filesize,
}
}
if (mode == IFDIR) {
- int len;
-
if (dp->d_name[0] == '.') {
if (dp->d_name[1] == '\0' ||
(dp->d_name[1] == '.' && dp->d_name[2] == '\0'))
continue;
}
- len = strlen(path) + strlen(dp->d_name) + 2;
- npath = malloc(len);
- if (npath == NULL)
+ if (asprintf(&npath, "%s/%s", path, dp->d_name) == -1)
errx(1, "malloc");
- snprintf(npath, len, "%s/%s", path, dp->d_name);
scanonedir(dp->d_ino, npath);
free(npath);
}