diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-12-10 22:50:23 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-12-10 22:50:23 +0100 |
commit | f44b2b59ec22903d98395a0543502551f9685e4d (patch) | |
tree | 7f16b4e093d9cb55151bc189054613eaeaffc4f4 /utils/expect_dump.c | |
parent | 367324c4af8167a9384f23fb419b31b9cf960ac0 (diff) |
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 <pablo@netfilter.org>
Diffstat (limited to 'utils/expect_dump.c')
-rw-r--r-- | utils/expect_dump.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/utils/expect_dump.c b/utils/expect_dump.c index d636d18..fa25bad 100644 --- a/utils/expect_dump.c +++ b/utils/expect_dump.c @@ -31,10 +31,13 @@ int main() nfexp_callback_register(h, NFCT_T_ALL, cb, NULL); ret = nfexp_query(h, NFCT_Q_DUMP, &family); - printf("TEST: get expectation (%d)(%s)\n", ret, strerror(errno)); - + printf("TEST: dumo expectation "); if (ret == -1) - exit(EXIT_FAILURE); + printf("(%d)(%s)\n", ret, strerror(errno)); + else + printf("(OK)\n"); + + nfct_close(h); - exit(EXIT_SUCCESS); + ret == -1 ? exit(EXIT_FAILURE) : exit(EXIT_SUCCESS); } |