Fix sbuf_finish() error code check in user-space.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
This commit is contained in:
Alexander Motin 2020-10-13 23:29:06 +00:00
parent 388197f414
commit cd500da924
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366689
3 changed files with 24 additions and 4 deletions

View file

@ -318,7 +318,12 @@ ata_cmd_string(struct ata_cmd *cmd, char *cmd_string, size_t len)
ata_cmd_sbuf(cmd, &sb);
error = sbuf_finish(&sb);
if (error != 0 && error != ENOMEM)
if (error != 0 &&
#ifdef _KERNEL
error != ENOMEM)
#else
errno != ENOMEM)
#endif
return ("");
return(sbuf_data(&sb));
@ -348,7 +353,12 @@ ata_res_string(struct ata_res *res, char *res_string, size_t len)
ata_res_sbuf(res, &sb);
error = sbuf_finish(&sb);
if (error != 0 && error != ENOMEM)
if (error != 0 &&
#ifdef _KERNEL
error != ENOMEM)
#else
errno != ENOMEM)
#endif
return ("");
return(sbuf_data(&sb));

View file

@ -152,7 +152,12 @@ nvme_cmd_string(const struct nvme_command *cmd, char *cmd_string, size_t len)
nvme_cmd_sbuf(cmd, &sb);
error = sbuf_finish(&sb);
if (error != 0 && error != ENOMEM)
if (error != 0 &&
#ifdef _KERNEL
error != ENOMEM)
#else
errno != ENOMEM)
#endif
return ("");
return(sbuf_data(&sb));

View file

@ -3486,7 +3486,12 @@ scsi_cdb_string(u_int8_t *cdb_ptr, char *cdb_string, size_t len)
/* ENOMEM just means that the fixed buffer is full, OK to ignore */
error = sbuf_finish(&sb);
if (error != 0 && error != ENOMEM)
if (error != 0 &&
#ifdef _KERNEL
error != ENOMEM)
#else
errno != ENOMEM)
#endif
return ("");
return(sbuf_data(&sb));