Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/resize_lfs don't use sprintf
details: https://anonhg.NetBSD.org/src/rev/cb452a0cb59e
branches: trunk
changeset: 328009:cb452a0cb59e
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Mar 23 05:26:23 2014 +0000
description:
don't use sprintf
diffstat:
sbin/resize_lfs/resize_lfs.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (29 lines):
diff -r cc64415e7a78 -r cb452a0cb59e sbin/resize_lfs/resize_lfs.c
--- a/sbin/resize_lfs/resize_lfs.c Sun Mar 23 05:07:59 2014 +0000
+++ b/sbin/resize_lfs/resize_lfs.c Sun Mar 23 05:26:23 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: resize_lfs.c,v 1.7 2013/06/19 01:07:55 christos Exp $ */
+/* $NetBSD: resize_lfs.c,v 1.8 2014/03/23 05:26:23 dholland Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -60,6 +60,7 @@
main(int argc, char **argv)
{
char *rdev, *fsname, buf[LFS_SBPAD];
+ size_t rdevlen;
daddr_t newsize, newnsegs;
int devfd, rootfd;
int ch, i, verbose;
@@ -95,8 +96,9 @@
*/
if (statvfs(fsname, &vfs) < 0)
err(1, "%s", fsname);
- rdev = (char *)malloc(strlen(vfs.f_mntfromname + 2));
- sprintf(rdev, "/dev/r%s", vfs.f_mntfromname + 5);
+ rdevlen = strlen(vfs.f_mntfromname) + 2;
+ rdev = malloc(rdevlen);
+ snprintf(rdev, rdevlen, "/dev/r%s", vfs.f_mntfromname + 5);
devfd = open(rdev, O_RDONLY);
if (devfd < 0)
err(1, "open raw device");
Home |
Main Index |
Thread Index |
Old Index