From 8eaa138d564f37cdbe73ad4c744cede496bf034e Mon Sep 17 00:00:00 2001 From: yamt Date: Sun, 26 Sep 2004 00:17:15 +0000 Subject: [PATCH] _FUNCNAME(ctype_wcrtomb): set *nresult on error rather than using stack garbage. --- lib/libc/citrus/citrus_ctype_template.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libc/citrus/citrus_ctype_template.h b/lib/libc/citrus/citrus_ctype_template.h index 9c63f38a2096..f4fb166fc626 100644 --- a/lib/libc/citrus/citrus_ctype_template.h +++ b/lib/libc/citrus/citrus_ctype_template.h @@ -1,4 +1,4 @@ -/* $NetBSD: citrus_ctype_template.h,v 1.28 2004/09/25 23:56:44 soda Exp $ */ +/* $NetBSD: citrus_ctype_template.h,v 1.29 2004/09/26 00:17:15 yamt Exp $ */ /*- * Copyright (c)2002 Citrus Project, @@ -594,8 +594,10 @@ _FUNCNAME(ctype_wcrtomb)(void * __restrict cl, char * __restrict s, wchar_t wc, /* reset state */ err = _FUNCNAME(put_state_reset)(_CEI_TO_EI(_TO_CEI(cl)), s, sz, psenc, &rsz); - if (err) + if (err) { + *nresult = -1; goto quit; + } s += rsz; sz -= rsz; }