diff options
author | Job Snijders <job@cvs.openbsd.org> | 2024-04-25 09:58:18 +0000 |
---|---|---|
committer | Job Snijders <job@cvs.openbsd.org> | 2024-04-25 09:58:18 +0000 |
commit | 86833d08f7ac3b93cc13c94ece5f6536dfd97df7 (patch) | |
tree | ea2de8a64374648005587b7b3215967b089f54c6 /usr.bin | |
parent | de3375a164a10080de4e2200e24814b4f03361f8 (diff) |
Don't divide by zero (empty files)
While there, also increase buf[]
OK claudio@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/vi/vi/vs_refresh.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/vi/vi/vs_refresh.c b/usr.bin/vi/vi/vs_refresh.c index 91769cfb3e6..37d03d82051 100644 --- a/usr.bin/vi/vi/vs_refresh.c +++ b/usr.bin/vi/vi/vs_refresh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs_refresh.c,v 1.24 2024/04/24 15:15:40 job Exp $ */ +/* $OpenBSD: vs_refresh.c,v 1.25 2024/04/25 09:58:17 job Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -781,7 +781,7 @@ vs_modeline(SCR *sp) size_t cols, curcol, curlen, endpoint, len, midpoint; const char *t = NULL; int ellipsis; - char *p, buf[20]; + char *p, buf[30]; recno_t last; /* @@ -859,7 +859,7 @@ vs_modeline(SCR *sp) if (O_ISSET(sp, O_RULER)) { vs_column(sp, &curcol); - if (db_last(sp, &last)) + if (db_last(sp, &last) || last == 0) len = snprintf(buf, sizeof(buf), "%lu,%zu", (ulong)sp->lno, curcol + 1); else |