CVS commit: src/sbin/resize_lfs

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:27:07 UTC 2023

Modified Files:
src/sbin/resize_lfs: resize_lfs.c

Log Message:
fix potentially uninitialised data being used.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sbin/resize_lfs/resize_lfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/resize_lfs

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:27:07 UTC 2023

Modified Files:
src/sbin/resize_lfs: resize_lfs.c

Log Message:
fix potentially uninitialised data being used.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sbin/resize_lfs/resize_lfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/resize_lfs/resize_lfs.c
diff -u src/sbin/resize_lfs/resize_lfs.c:1.15 src/sbin/resize_lfs/resize_lfs.c:1.16
--- src/sbin/resize_lfs/resize_lfs.c:1.15	Thu Aug 22 20:26:07 2019
+++ src/sbin/resize_lfs/resize_lfs.c	Mon Aug  7 23:27:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_lfs.c,v 1.15 2019/08/22 20:26:07 brad Exp $	*/
+/*	$NetBSD: resize_lfs.c,v 1.16 2023/08/07 23:27:07 mrg Exp $	*/
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -124,7 +124,7 @@ main(int argc, char **argv)
 		err(1, "open filesystem root");
 
 	/* Read the superblock, finding alternates if necessary */
-	fs = (struct lfs *)malloc(sizeof(*fs));
+	fs = (struct lfs *)calloc(sizeof(*fs), 1);
 	for (sboff = LFS_LABELPAD;;) {
 		pread(devfd, buf, sboff, LFS_SBPAD);
 		__CTASSERT(sizeof(struct dlfs) == sizeof(struct dlfs64));



CVS commit: src/sbin/resize_lfs

2019-08-22 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Thu Aug 22 20:26:07 UTC 2019

Modified Files:
src/sbin/resize_lfs: resize_lfs.c

Log Message:
Use getdiskrawname to find the device name.

Reviewed by Christos


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sbin/resize_lfs/resize_lfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/resize_lfs/resize_lfs.c
diff -u src/sbin/resize_lfs/resize_lfs.c:1.14 src/sbin/resize_lfs/resize_lfs.c:1.15
--- src/sbin/resize_lfs/resize_lfs.c:1.14	Sun Aug  2 18:18:09 2015
+++ src/sbin/resize_lfs/resize_lfs.c	Thu Aug 22 20:26:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_lfs.c,v 1.14 2015/08/02 18:18:09 dholland Exp $	*/
+/*	$NetBSD: resize_lfs.c,v 1.15 2019/08/22 20:26:07 brad Exp $	*/
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "partutil.h"
 
@@ -98,7 +99,8 @@ main(int argc, char **argv)
 		err(1, "%s", fsname);
 	rdevlen = strlen(vfs.f_mntfromname) + 2;
 	rdev = malloc(rdevlen);
-	snprintf(rdev, rdevlen, "/dev/r%s", vfs.f_mntfromname + 5);
+	if (getdiskrawname(rdev, rdevlen, vfs.f_mntfromname) == NULL)
+		err(1, "Could not convert '%s' to raw name", vfs.f_mntfromname);
 	devfd = open(rdev, O_RDONLY);
 	if (devfd < 0)
 		err(1, "open raw device");



CVS commit: src/sbin/resize_lfs

2019-08-22 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Thu Aug 22 20:26:07 UTC 2019

Modified Files:
src/sbin/resize_lfs: resize_lfs.c

Log Message:
Use getdiskrawname to find the device name.

Reviewed by Christos


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sbin/resize_lfs/resize_lfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.