Handle snprintf() returning -1

MFC after:	2 weeks
This commit is contained in:
brian 2001-08-20 12:41:36 +00:00
parent 540c23ed8a
commit d3f8bf4154

View File

@ -260,7 +260,7 @@ _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf)
else
i = snprintf(buf, buf_len, "%s", p->pw_name);
if (i >= buf_len) {
if (i < 0 || i >= buf_len) {
errno = ENOMEM;
return (-1);
}
@ -273,7 +273,7 @@ _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf)
else
i = snprintf(buf, buf_len, "%s", g->gr_name);
if (i >= buf_len) {
if (i < 0 || i >= buf_len) {
errno = ENOMEM;
return (-1);
}