From f44b2b59ec22903d98395a0543502551f9685e4d Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 10 Dec 2008 22:50:23 +0100 Subject: utils: fix wrong use of errno in example files This patch removes the use of strerr(errno) when the returned valued is != -1. This fixes random segfaults in my x86_64 machines. According to the documentation, errno should not be used unless the returned value is -1. This patch also includes some missing nfct_close() calls in the examples. Signed-off-by: Pablo Neira Ayuso --- utils/expect_delete.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'utils/expect_delete.c') diff --git a/utils/expect_delete.c b/utils/expect_delete.c index e6255da..a402757 100644 --- a/utils/expect_delete.c +++ b/utils/expect_delete.c @@ -41,10 +41,11 @@ int main() ret = nfexp_query(h, NFCT_Q_DESTROY, exp); - printf("TEST: delete expectation (%d)(%s)\n", ret, strerror(errno)); - + printf("TEST: delete expectation "); if (ret == -1) - exit(EXIT_FAILURE); + printf("(%d)(%s)\n", ret, strerror(errno)); + else + printf("(OK)\n"); - exit(EXIT_SUCCESS); + ret == -1 ? exit(EXIT_FAILURE) : exit(EXIT_SUCCESS); } -- cgit v1.2.3