Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc reallocarr does not set errno.
details: https://anonhg.NetBSD.org/src/rev/54d125ba444c
branches: trunk
changeset: 990501:54d125ba444c
user: nia <nia%NetBSD.org@localhost>
date: Fri Oct 29 11:03:46 2021 +0000
description:
reallocarr does not set errno.
diffstat:
lib/libc/stdlib/radixsort.c | 8 +++++---
lib/libc/string/wcsdup.c | 9 ++++++---
2 files changed, 11 insertions(+), 6 deletions(-)
diffs (66 lines):
diff -r ab5101d19e44 -r 54d125ba444c lib/libc/stdlib/radixsort.c
--- a/lib/libc/stdlib/radixsort.c Fri Oct 29 10:54:56 2021 +0000
+++ b/lib/libc/stdlib/radixsort.c Fri Oct 29 11:03:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radixsort.c,v 1.20 2021/10/29 10:29:51 nia Exp $ */
+/* $NetBSD: radixsort.c,v 1.21 2021/10/29 11:03:46 nia Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)radixsort.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: radixsort.c,v 1.20 2021/10/29 10:29:51 nia Exp $");
+__RCSID("$NetBSD: radixsort.c,v 1.21 2021/10/29 11:03:46 nia Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -130,8 +130,10 @@
simplesort(a, n, 0, tr, endch);
else {
ta = NULL;
- if (reallocarr(&ta, n, sizeof(a)) != 0)
+ if (reallocarr(&ta, n, sizeof(a)) != 0) {
+ errno = ENOMEM;
return (-1);
+ }
r_sort_b(a, ta, n, 0, tr, endch);
free(ta);
}
diff -r ab5101d19e44 -r 54d125ba444c lib/libc/string/wcsdup.c
--- a/lib/libc/string/wcsdup.c Fri Oct 29 10:54:56 2021 +0000
+++ b/lib/libc/string/wcsdup.c Fri Oct 29 11:03:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wcsdup.c,v 1.4 2021/10/29 10:11:57 nia Exp $ */
+/* $NetBSD: wcsdup.c,v 1.5 2021/10/29 11:03:46 nia Exp $ */
/*
* Copyright (C) 2006 Aleksey Cheusov
@@ -14,12 +14,13 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcsdup.c,v 1.4 2021/10/29 10:11:57 nia Exp $");
+__RCSID("$NetBSD: wcsdup.c,v 1.5 2021/10/29 11:03:46 nia Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <stdlib.h>
#include <assert.h>
+#include <errno.h>
#include <wchar.h>
__weak_alias(wcsdup,_wcsdup)
@@ -35,8 +36,10 @@
len = wcslen(str) + 1;
copy = NULL;
- if (reallocarr(©, len, sizeof(wchar_t)) != 0)
+ if (reallocarr(©, len, sizeof(wchar_t)) != 0) {
+ errno = ENOMEM;
return NULL;
+ }
return wmemcpy(copy, str, len);
}
Home |
Main Index |
Thread Index |
Old Index