Module Name: src
Committed By: mrg
Date: Thu Feb 22 02:11:29 UTC 2024
Modified Files:
src/sbin/newfs: mkfs.c
Log Message:
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.135 -r1.136 src/sbin/newfs/mkfs.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/mkfs.c
diff -u src/sbin/newfs/mkfs.c:1.135 src/sbin/newfs/mkfs.c:1.136
--- src/sbin/newfs/mkfs.c:1.135 Wed Jul 5 10:58:58 2023
+++ src/sbin/newfs/mkfs.c Thu Feb 22 02:11:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mkfs.c,v 1.135 2023/07/05 10:58:58 riastradh Exp $ */
+/* $NetBSD: mkfs.c,v 1.136 2024/02/22 02:11:29 mrg Exp $ */
/*
* Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
#if 0
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: mkfs.c,v 1.135 2023/07/05 10:58:58 riastradh Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.136 2024/02/22 02:11:29 mrg Exp $");
#endif
#endif /* not lint */
@@ -672,7 +672,8 @@ mkfs(const char *fsys, int fi, int fo,
fld_width = verbosity < 4 ? 1 : snprintf(NULL, 0, "%" PRIu64,
(uint64_t)FFS_FSBTODB(&sblock, cgsblock(&sblock, sblock.fs_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;