diff options
author | Paul Moore <pmoore@redhat.com> | 2012-04-13 11:54:09 -0400 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2012-04-13 11:54:09 -0400 |
commit | cb120c3eb209f9b6d185117f11f3428a96ac768b (patch) | |
tree | e2ce9568b41751d405952415a327f222ec23309b | |
parent | 30c4653381914a14229a76a00e2f518e14339e27 (diff) | |
download | libseccomp-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.c | 4 | ||||
-rw-r--r-- | tests/11-basic-errors.c | 2 |
2 files changed, 3 insertions, 3 deletions
@@ -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(); |