mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
__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
This commit is contained in:
parent
51bcc337dd
commit
dc8507e1f7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324103
@ -125,8 +125,7 @@ __collate_load_tables_l(const char *encoding, struct xlocale_collate *table)
|
||||
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) {
|
||||
|
@ -110,9 +110,8 @@ __setrunelocale(struct xlocale_ctype *l, const char *encoding)
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user