svn commit: r324103 - head/lib/libc/locale
Bryan Drewery
bdrewery at FreeBSD.org
Fri Sep 29 16:30:51 UTC 2017
Author: bdrewery
Date: Fri Sep 29 16:30:50 2017
New Revision: 324103
URL: https://svnweb.freebsd.org/changeset/base/324103
Log:
__setrunelocale: Fix asprintf(3) failure not returning an error.
Also fix the style of the asprintf(3) call in __collate_load_tables_l().
Both of these lines were modified away from snprintf(3) during the
import from DragonFly/Illumos.
Reviewed by: jilles (briefly over shoulder)
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Modified:
head/lib/libc/locale/collate.c
head/lib/libc/locale/setrunelocale.c
Modified: head/lib/libc/locale/collate.c
==============================================================================
--- head/lib/libc/locale/collate.c Fri Sep 29 15:53:26 2017 (r324102)
+++ head/lib/libc/locale/collate.c Fri Sep 29 16:30:50 2017 (r324103)
@@ -125,8 +125,7 @@ __collate_load_tables_l(const char *encoding, struct x
return (_LDP_CACHE);
}
- asprintf(&buf, "%s/%s/LC_COLLATE", _PathLocale, encoding);
- if (buf == NULL)
+ if (asprintf(&buf, "%s/%s/LC_COLLATE", _PathLocale, encoding) == -1)
return (_LDP_ERROR);
if ((fd = _open(buf, O_RDONLY)) < 0) {
Modified: head/lib/libc/locale/setrunelocale.c
==============================================================================
--- head/lib/libc/locale/setrunelocale.c Fri Sep 29 15:53:26 2017 (r324102)
+++ head/lib/libc/locale/setrunelocale.c Fri Sep 29 16:30:50 2017 (r324103)
@@ -110,9 +110,8 @@ __setrunelocale(struct xlocale_ctype *l, const char *e
}
/* Range checking not needed, encoding length already checked before */
- asprintf(&path, "%s/%s/LC_CTYPE", _PathLocale, encoding);
- if (path == NULL)
- return (0);
+ if (asprintf(&path, "%s/%s/LC_CTYPE", _PathLocale, encoding) == -1)
+ return (errno);
if ((rl = _Read_RuneMagi(path)) == NULL) {
free(path);
More information about the svn-src-head
mailing list