From 9d790fdba9309d5dfca2c87cfbd2ad69518a6ce1 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 27 Mar 2026 20:05:58 +0000 Subject: [PATCH] catgets(3): set errno when a message isn't found as per POSIX. The same change was made by NetBSD in rev 1.13 in 1998. Flagged by Sortix os-test. ok guenther@ --- lib/libc/nls/catgets.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libc/nls/catgets.c b/lib/libc/nls/catgets.c index b0ecc598f00..c5ab8301315 100644 --- a/lib/libc/nls/catgets.c +++ b/lib/libc/nls/catgets.c @@ -1,4 +1,4 @@ -/* $OpenBSD: catgets.c,v 1.9 2015/09/05 11:25:30 guenther Exp $ */ +/* $OpenBSD: catgets.c,v 1.10 2026/03/27 20:05:58 daniel Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. @@ -82,6 +82,7 @@ catgets(nl_catd catd, int set_id, int msg_id, const char *s) } /* not found */ + errno = ENOMSG; return (char *) s; } else if (r < 0) { @@ -92,6 +93,7 @@ catgets(nl_catd catd, int set_id, int msg_id, const char *s) } /* not found */ + errno = ENOMSG; return (char *) s; } DEF_WEAK(catgets);