X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-comm.c;h=92d0fd70da205ecad68d9da6a963d94eda728422;hb=64b2564ef0aa2d7050902e859fa962049daa8508;hp=f11b7d0142a3b210fa6bfd2ce2c606bba83f93ed;hpb=8fb0c941d4b87505608faa4af4d59300c4a8950c;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index f11b7d01..92d0fd70 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -376,10 +376,31 @@ end: * we already have a more precise error message to * report. */ - if (ret > -LTTNG_UST_ERR) - lur.ret_code = -LTTNG_UST_ERR; - else + if (ret > -LTTNG_UST_ERR) { + /* Translate code to UST error. */ + switch (ret) { + case -EEXIST: + lur.ret_code = -LTTNG_UST_ERR_EXIST; + break; + case -EINVAL: + lur.ret_code = -LTTNG_UST_ERR_INVAL; + break; + case -ENOENT: + lur.ret_code = -LTTNG_UST_ERR_NOENT; + break; + case -EPERM: + lur.ret_code = -LTTNG_UST_ERR_PERM; + break; + case -ENOSYS: + lur.ret_code = -LTTNG_UST_ERR_NOSYS; + break; + default: + lur.ret_code = -LTTNG_UST_ERR; + break; + } + } else { lur.ret_code = ret; + } } if (ret >= 0) { switch (lum->cmd) {