diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2021-06-20 13:19:40 -0700 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2021-06-20 13:19:40 -0700 |
commit | 2efece0bb49860456ca9357c1e1087bf6f788857 (patch) | |
tree | 509c53b02c5c67635414c0aebe4a9ebb0d13fd73 | |
parent | 2c99ecd7ee8580cced618dd9d16473f15e778e5e (diff) | |
download | libcap2-2efece0bb49860456ca9357c1e1087bf6f788857.tar.gz |
Clean up some compilation warnings
Also amend .gitignore to ignore uns_test binary in the progs directory.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r-- | libcap/cap_text.c | 2 | ||||
-rw-r--r-- | progs/.gitignore | 1 | ||||
-rw-r--r-- | tests/uns_test.c | 7 |
3 files changed, 7 insertions, 3 deletions
diff --git a/libcap/cap_text.c b/libcap/cap_text.c index b0fad9d..87e0838 100644 --- a/libcap/cap_text.c +++ b/libcap/cap_text.c @@ -315,7 +315,7 @@ char *cap_to_name(cap_value_t cap) #endif char *tmp, *result; - asprintf(&tmp, "%u", cap); + (void) asprintf(&tmp, "%u", cap); result = _libcap_strdup(tmp); free(tmp); diff --git a/progs/.gitignore b/progs/.gitignore index 978229e..eed1982 100644 --- a/progs/.gitignore +++ b/progs/.gitignore @@ -5,3 +5,4 @@ getpcaps setcap verify-caps compare-cap +uns_test diff --git a/tests/uns_test.c b/tests/uns_test.c index 43470cf..41aa0a6 100644 --- a/tests/uns_test.c +++ b/tests/uns_test.c @@ -137,7 +137,10 @@ int main(int argc, char **argv) } } - write(fds.to[1], ".", 1); + if (write(fds.to[1], ".", 1) != 1) { + perror("failed to write '.'"); + exit(1); + } close(fds.to[1]); fprintf(stderr, "user namespace launched exploit worked - upgrade kernel\n"); @@ -149,6 +152,6 @@ int main(int argc, char **argv) bailok: fprintf(stderr, "exploit attempt failed\n"); - write(fds.to[1], "!", 1); + (void) write(fds.to[1], "!", 1); exit(0); } |