Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Mar 2025 18:35:49 GMT
From:      Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a4251e93f8cb - stable/14 - top: Make locale issues non-fatal.
Message-ID:  <202503311835.52VIZnG6056740@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=a4251e93f8cb008607bf9b50bd2fd95d3223dad1

commit a4251e93f8cb008607bf9b50bd2fd95d3223dad1
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-03-06 13:43:44 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-03-31 18:35:33 +0000

    top: Make locale issues non-fatal.
    
    If the `setlocale()` call fails, emit a warning and sleep briefly so the
    user has a chance to see the warning before we redraw the screen.  Note
    that we have no way of knowing exactly what is wrong, but at least we
    can suggest that they check their environment.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Reviewed by:    kevans
    Differential Revision:  https://reviews.freebsd.org/D49230
    
    (cherry picked from commit 180065eb09e699820a1e1c45d3d00156e0effe29)
---
 usr.bin/top/top.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c
index 2b468c453e26..856ad838dc1c 100644
--- a/usr.bin/top/top.c
+++ b/usr.bin/top/top.c
@@ -266,8 +266,8 @@ main(int argc, const char *argv[])
 #endif
 
     if (setlocale(LC_ALL, "") == NULL) {
-        fprintf(stderr, "invalid locale.\n");
-	exit(1);
+	warnx("invalid locale, check your environment");
+	sleep(2);
     }
 
     mypid = getpid();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202503311835.52VIZnG6056740>