Module Name: src
Committed By: tsutsui
Date: Thu Feb 22 14:11:52 UTC 2024
Modified Files:
src/sbin/newfs_ext2fs: mke2fs.c
Log Message:
Pull a change of newfs/mkfs.c rev 1.136:
> if the window size works but is 0, assume it didn't work and use 80.
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sbin/newfs_ext2fs/mke2fs.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/newfs_ext2fs/mke2fs.c
diff -u src/sbin/newfs_ext2fs/mke2fs.c:1.26 src/sbin/newfs_ext2fs/mke2fs.c:1.27
--- src/sbin/newfs_ext2fs/mke2fs.c:1.26 Wed May 17 09:54:59 2023
+++ src/sbin/newfs_ext2fs/mke2fs.c Thu Feb 22 14:11:52 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mke2fs.c,v 1.26 2023/05/17 09:54:59 tsutsui Exp $ */
+/* $NetBSD: mke2fs.c,v 1.27 2024/02/22 14:11:52 tsutsui Exp $ */
/*-
* Copyright (c) 2007 Izumi Tsutsui. All rights reserved.
@@ -100,7 +100,7 @@
#if 0
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: mke2fs.c,v 1.26 2023/05/17 09:54:59 tsutsui Exp $");
+__RCSID("$NetBSD: mke2fs.c,v 1.27 2024/02/22 14:11:52 tsutsui Exp $");
#endif
#endif /* not lint */
@@ -594,7 +594,8 @@ mke2fs(const char *fsys, int fi, int fo)
fld_width = verbosity < 4 ? 1 : snprintf(NULL, 0, "%" PRIu64,
(uint64_t)cgbase(&sblock, ncg - 1));
/* Get terminal width */
- if (ioctl(fileno(stdout), TIOCGWINSZ, &winsize) == 0)
+ if (ioctl(fileno(stdout), TIOCGWINSZ, &winsize) == 0 &&
+ winsize.ws_col != 0)
max_cols = winsize.ws_col;
else
max_cols = 80;