aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsmael Luceno <ismael@iodev.co.uk>2024-01-25 07:56:58 +0100
committerMatěj Cepl <mcepl@cepl.eu>2024-05-19 09:03:59 +0200
commitbcdfa6b7ce3184b1fd7372716703248aeb14384e (patch)
tree70ed1c70a3ff2807f84ab45181787a5a0ada8f8d
parent20e9865618c06205616db9f1196535bc0c6e9332 (diff)
downloadlout-nits.tar.gz
Avoid calling catclose with an invalid argumentnits
POSIX doesn't specify that catclose should accept -1 as argument, and with musl (1.2.4 and earlier at least) it causes a segfault.
-rw-r--r--z01.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/z01.c b/z01.c
index f18d4ce..d4953b8 100644
--- a/z01.c
+++ b/z01.c
@@ -974,7 +974,8 @@ int main(int argc, char *argv[])
while( run_num <= runs_to_do );
#if LOCALE_ON
- catclose(MsgCat);
+ if (MsgCat != (nl_catd)-1)
+ catclose(MsgCat);
#endif
exit(0);