diff options
author | Paul Moore <paul@paul-moore.com> | 2020-06-06 14:06:28 -0400 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2020-06-16 11:22:29 -0400 |
commit | 027cc6031461e67d4c6a9a3463540a8433f2fcd4 (patch) | |
tree | 31575b116d0347d739801e83ed94a15816569f53 /tests | |
parent | c1ed3d958e53df9303dd48371b1225363803596b (diff) | |
download | libseccomp-027cc6031461e67d4c6a9a3463540a8433f2fcd4.tar.gz |
tools,tests: fixup errno handling to be more consistent
The basic idea is that the C functions should return negative values
on error and the terminal programs should return positive, non-zero
values on error.
Reported-by: Tom Hromatka <tom.hromatka@oracle.com>
Acked-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/util.c b/tests/util.c index a84e475..d212c04 100644 --- a/tests/util.c +++ b/tests/util.c @@ -200,14 +200,14 @@ int util_file_write(const char *path) fd = open(path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); if (fd < 0) - return errno; + return -errno; if (write(fd, buf, buf_len) < buf_len) { - int rc = errno; + int rc = -errno; close(fd); return rc; } if (close(fd) < 0) - return errno; + return -errno; return 0; } |