summaryrefslogtreecommitdiff
path: root/libexec/lfs_cleanerd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-12 15:49:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-12 15:49:41 +0000
commita2235ae2815fbe930bb042cd0fcfffa5cefabd45 (patch)
tree66fc4499ab02b473d8bdc3b3686d5435fba66b45 /libexec/lfs_cleanerd
parent0bcc74a86eb34bd24e67640766f7995a5754006e (diff)
use asprintf; ok dhill@mindcry.org
update to dinode changes; ok pedro
Diffstat (limited to 'libexec/lfs_cleanerd')
-rw-r--r--libexec/lfs_cleanerd/library.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/libexec/lfs_cleanerd/library.c b/libexec/lfs_cleanerd/library.c
index b37dc67a292..5992a3933e6 100644
--- a/libexec/lfs_cleanerd/library.c
+++ b/libexec/lfs_cleanerd/library.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: library.c,v 1.11 2003/06/11 14:24:46 deraadt Exp $ */
+/* $OpenBSD: library.c,v 1.12 2005/11/12 15:49:40 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -31,7 +31,7 @@
#ifndef lint
/*static char sccsid[] = "@(#)library.c 8.3 (Berkeley) 5/24/95";*/
-static char rcsid[] = "$OpenBSD: library.c,v 1.11 2003/06/11 14:24:46 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: library.c,v 1.12 2005/11/12 15:49:40 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -159,17 +159,13 @@ void
get_ifile(FS_INFO *fsp, int use_mmap)
{
struct stat file_stat;
- caddr_t ifp;
+ caddr_t ifp = NULL;
char *ifile_name;
int count, fid;
- int len;
-
- ifp = NULL;
- len = strlen(fsp->fi_statfsp->f_mntonname) + strlen(IFILE_NAME) + 2;
- ifile_name = malloc(len);
- snprintf(ifile_name, len, "%s/%s", fsp->fi_statfsp->f_mntonname,
- IFILE_NAME);
+ if (asprintf(&ifile_name, "%s/%s", fsp->fi_statfsp->f_mntonname,
+ IFILE_NAME) == -1)
+ err(1, "get_ifile: asprintf");
if ((fid = open(ifile_name, O_RDWR, (mode_t)0)) < 0)
err(1, "get_ifile: bad open");
@@ -412,7 +408,7 @@ void
add_inodes(FS_INFO *fsp, BLOCK_INFO *bip, int *countp, SEGSUM *sp,
caddr_t seg_buf, daddr_t seg_addr)
{
- struct dinode *di;
+ struct ufs1_dinode *di;
struct lfs *lfsp;
IFILE *ifp;
BLOCK_INFO *bp;
@@ -432,7 +428,7 @@ add_inodes(FS_INFO *fsp, BLOCK_INFO *bip, int *countp, SEGSUM *sp,
for (i = 0; i < sp->ss_ninos; ++i) {
if (i % INOPB(lfsp) == 0) {
--daddrp;
- di = (struct dinode *)(seg_buf +
+ di = (struct ufs1_dinode *)(seg_buf +
((*daddrp - seg_addr) << fsp->fi_daddr_shift));
} else
++di;