summaryrefslogtreecommitdiff
path: root/tests/47-live-kill_process.c
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2019-03-12 11:54:22 -0400
committerPaul Moore <paul@paul-moore.com>2019-03-12 11:54:22 -0400
commit1b914c3db514bf2ed73a9335c6e8a36f231af70f (patch)
tree616224d020846ce39c295604b3697213a267ec90 /tests/47-live-kill_process.c
parent1ab1f211bae9635064a87819036d01b2b789563a (diff)
downloadlibseccomp-1b914c3db514bf2ed73a9335c6e8a36f231af70f.tar.gz
tests: fix some issues found by coverity
None of these are major, and they are all part of the tests, but we should fix them regardless. Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'tests/47-live-kill_process.c')
-rw-r--r--tests/47-live-kill_process.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/47-live-kill_process.c b/tests/47-live-kill_process.c
index 0311855..7da407f 100644
--- a/tests/47-live-kill_process.c
+++ b/tests/47-live-kill_process.c
@@ -53,24 +53,21 @@ static const unsigned int whitelist[] = {
*/
void *child_start(void *param)
{
- int fd, *i = (int *)param;
-
- *i = 1;
+ int fd;
/* make a disallowed syscall */
fd = open("/dev/null", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
/* we should never get here. seccomp should kill the entire
- * process when open() is called.
- */
- if (fd < 0)
- *i = fd;
+ * process when open() is called. */
+ if (fd >= 0)
+ close(fd);
return NULL;
}
int main(int argc, char *argv[])
{
- int rc, i, param = 0;
+ int rc, i;
scmp_filter_ctx ctx = NULL;
pthread_t child_thread;
@@ -88,7 +85,7 @@ int main(int argc, char *argv[])
if (rc != 0)
goto out;
- rc = pthread_create(&child_thread, NULL, child_start, &param);
+ rc = pthread_create(&child_thread, NULL, child_start, NULL);
if (rc != 0)
goto out;