FreeBSD: Use SET_ERROR to trace xattr name errors

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #11997
This commit is contained in:
Ryan Moeller 2021-04-28 19:19:28 +00:00 committed by Brian Behlendorf
parent 793dffb04e
commit c2c02e490f
1 changed files with 4 additions and 4 deletions

View File

@ -5264,10 +5264,10 @@ zfs_create_attrname(int attrnamespace, const char *name, char *attrname,
/* We don't allow '/' character in attribute name. */
if (strchr(name, '/') != NULL)
return (EINVAL);
return (SET_ERROR(EINVAL));
/* We don't allow attribute names that start with "freebsd:" string. */
if (strncmp(name, "freebsd:", 8) == 0)
return (EINVAL);
return (SET_ERROR(EINVAL));
bzero(attrname, size);
@ -5292,11 +5292,11 @@ zfs_create_attrname(int attrnamespace, const char *name, char *attrname,
break;
case EXTATTR_NAMESPACE_EMPTY:
default:
return (EINVAL);
return (SET_ERROR(EINVAL));
}
if (snprintf(attrname, size, "%s%s%s%s", prefix, namespace, suffix,
name) >= size) {
return (ENAMETOOLONG);
return (SET_ERROR(ENAMETOOLONG));
}
return (0);
}