summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2012-04-13 11:54:09 -0400
committerPaul Moore <pmoore@redhat.com>2012-04-13 11:54:09 -0400
commitcb120c3eb209f9b6d185117f11f3428a96ac768b (patch)
treee2ce9568b41751d405952415a327f222ec23309b
parent30c4653381914a14229a76a00e2f518e14339e27 (diff)
downloadlibseccomp-cb120c3eb209f9b6d185117f11f3428a96ac768b.tar.gz
api: error conditions are indicated by negative return values
Fix some problems where we return "errno" instead of "-errno". Signed-off-by: Paul Moore <pmoore@redhat.com>
-rw-r--r--src/api.c4
-rw-r--r--tests/11-basic-errors.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/api.c b/src/api.c
index 1b5a263..0ceb660 100644
--- a/src/api.c
+++ b/src/api.c
@@ -113,7 +113,7 @@ int seccomp_load(void)
rc = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, program);
gen_bpf_release(program);
if (rc < 0)
- return errno;
+ return -errno;
return 0;
}
@@ -280,7 +280,7 @@ int seccomp_gen_bpf(int fd)
rc = write(fd, program->blks, BPF_PGM_SIZE(program));
gen_bpf_release(program);
if (rc < 0)
- return errno;
+ return -errno;
return 0;
}
diff --git a/tests/11-basic-errors.c b/tests/11-basic-errors.c
index ebdf12d..b7e1562 100644
--- a/tests/11-basic-errors.c
+++ b/tests/11-basic-errors.c
@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
return rc;
else {
rc = seccomp_gen_bpf(sysconf(_SC_OPEN_MAX)-1);
- if (rc != EBADF)
+ if (rc != -EBADF)
return -1;
}
seccomp_release();