diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-05-22 06:07:01 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-05-22 06:07:01 +0000 |
commit | 3560c67cd3c2ef49b0fdf0beb609ba65462759e7 (patch) | |
tree | c0a34b694605965730fb533ace53c50aed20f4da /libexec/lfs_cleanerd | |
parent | 5573bad6dd4166c4d5c21505821c56409b0bdff2 (diff) |
snprintf, and make it compile
Diffstat (limited to 'libexec/lfs_cleanerd')
-rw-r--r-- | libexec/lfs_cleanerd/cleanerd.c | 6 | ||||
-rw-r--r-- | libexec/lfs_cleanerd/library.c | 16 |
2 files changed, 12 insertions, 10 deletions
diff --git a/libexec/lfs_cleanerd/cleanerd.c b/libexec/lfs_cleanerd/cleanerd.c index fbf10090da5..f1fd1dc496f 100644 --- a/libexec/lfs_cleanerd/cleanerd.c +++ b/libexec/lfs_cleanerd/cleanerd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cleanerd.c,v 1.8 2002/02/17 19:42:26 millert Exp $ */ +/* $OpenBSD: cleanerd.c,v 1.9 2002/05/22 06:07:00 deraadt Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "@(#)cleanerd.c 8.5 (Berkeley) 6/10/95";*/ -static char rcsid[] = "$OpenBSD: cleanerd.c,v 1.8 2002/02/17 19:42:26 millert Exp $"; +static char rcsid[] = "$OpenBSD: cleanerd.c,v 1.9 2002/05/22 06:07:00 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -95,7 +95,7 @@ int lfs_markv(fsid_t *, BLOCK_INFO *, int); int bi_tossold(const void *, const void *, const void *); int choose_segments(FS_INFO *, struct seglist *, int (*)(FS_INFO *, SEGUSE *)); -void clean_fs((FS_INFO *, int (*)(FS_INFO *, SEGUSE *), int, long); +void clean_fs(FS_INFO *, int (*)(FS_INFO *, SEGUSE *), int, long); int clean_loop(FS_INFO *, int, long); int clean_segment(FS_INFO *, int); int cost_benefit(FS_INFO *, SEGUSE *); diff --git a/libexec/lfs_cleanerd/library.c b/libexec/lfs_cleanerd/library.c index 51e4b0202a1..a04479bd505 100644 --- a/libexec/lfs_cleanerd/library.c +++ b/libexec/lfs_cleanerd/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.6 2002/02/17 19:42:26 millert Exp $ */ +/* $OpenBSD: library.c,v 1.7 2002/05/22 06:07:00 deraadt Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -35,7 +35,7 @@ #ifndef lint /*static char sccsid[] = "@(#)library.c 8.3 (Berkeley) 5/24/95";*/ -static char rcsid[] = "$OpenBSD: library.c,v 1.6 2002/02/17 19:42:26 millert Exp $"; +static char rcsid[] = "$OpenBSD: library.c,v 1.7 2002/05/22 06:07:00 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -150,8 +150,8 @@ get_superblock (fsp, sbp) char mntfromname[MNAMELEN+1]; int fid; - strcpy(mntfromname, "/dev/r"); - strcat(mntfromname, fsp->fi_statfsp->f_mntfromname+5); + snprintf(mntfromname, sizeof mntfromname, "/dev/r%s", + fsp->fi_statfsp->f_mntfromname+5); if ((fid = open(mntfromname, O_RDONLY, (mode_t)0)) < 0) { err(0, "get_superblock: bad open"); @@ -178,11 +178,13 @@ get_ifile (fsp, use_mmap) caddr_t ifp; char *ifile_name; int count, fid; + int len; ifp = NULL; - ifile_name = malloc(strlen(fsp->fi_statfsp->f_mntonname) + - strlen(IFILE_NAME)+2); - strcat(strcat(strcpy(ifile_name, fsp->fi_statfsp->f_mntonname), "/"), + 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 ((fid = open(ifile_name, O_RDWR, (mode_t)0)) < 0) |