Module Name: src
Committed By: nia
Date: Fri Oct 29 11:03:46 UTC 2021
Modified Files:
src/lib/libc/stdlib: radixsort.c
src/lib/libc/string: wcsdup.c
Log Message:
reallocarr does not set errno.
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/stdlib/radixsort.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/string/wcsdup.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdlib/radixsort.c
diff -u src/lib/libc/stdlib/radixsort.c:1.20 src/lib/libc/stdlib/radixsort.c:1.21
--- src/lib/libc/stdlib/radixsort.c:1.20 Fri Oct 29 10:29:51 2021
+++ src/lib/libc/stdlib/radixsort.c Fri Oct 29 11:03:46 2021
@@ -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 @@ sradixsort(const u_char **a, int n, cons
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);
}
Index: src/lib/libc/string/wcsdup.c
diff -u src/lib/libc/string/wcsdup.c:1.4 src/lib/libc/string/wcsdup.c:1.5
--- src/lib/libc/string/wcsdup.c:1.4 Fri Oct 29 10:11:57 2021
+++ src/lib/libc/string/wcsdup.c Fri Oct 29 11:03:46 2021
@@ -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 @@ wcsdup(const wchar_t *str)
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);
}