Error codes should be returned as negative values

Signed-off-by: Clay Freeman <git@clayfreeman.com>
This commit is contained in:
Clay Freeman 2021-01-14 18:27:37 -06:00 committed by Hector Martin
parent 0d4de2f2ea
commit b0b3548f1d

View file

@ -147,10 +147,10 @@ const int adt_getprop_copy(const void *adt, int nodeoffset, const char *name,
const void *p = adt_getprop(adt, nodeoffset, name, &plen);
if (!p)
return ADT_ERR_NOTFOUND;
return -ADT_ERR_NOTFOUND;
if (plen != len)
return ADT_ERR_BADLENGTH;
return -ADT_ERR_BADLENGTH;
memcpy(out, p, len);
return len;