Some functions return positive `lttng_error_code` enumerator values
while other return negative values.
Make lttng_strerror() accept positive and negative codes. This improves
the API UX and will make the documentation less complex.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I359cef98ae32991d1a01b7f2cd484ece7bab2df9
/*
* Returns a human readable string describing
- * the error code (a negative value).
+ * the error code (positive or negative value).
*/
const char *lttng_strerror(int code)
{
+ if (code > 0) {
+ code = -code;
+ }
+
return error_get_str(code);
}