diff options
Diffstat (limited to 'libctf/testsuite/libctf-lookup/add-to-opened.c')
-rw-r--r-- | libctf/testsuite/libctf-lookup/add-to-opened.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libctf/testsuite/libctf-lookup/add-to-opened.c b/libctf/testsuite/libctf-lookup/add-to-opened.c index 96629af..700257e 100644 --- a/libctf/testsuite/libctf-lookup/add-to-opened.c +++ b/libctf/testsuite/libctf-lookup/add-to-opened.c @@ -15,7 +15,7 @@ main (int argc, char *argv[]) ctf_encoding_t en = { CTF_INT_SIGNED, 0, sizeof (int) }; unsigned char *ctf_written; size_t size; - int err; + int err = 666; if (argc != 2) { @@ -25,9 +25,18 @@ main (int argc, char *argv[]) if ((ctf = ctf_open (argv[1], NULL, &err)) == NULL) goto open_err; + + /* The error int should be reset on success as well as on error. */ + if (err != 0) + goto err_err; + + err = 666; if ((fp = ctf_dict_open (ctf, NULL, &err)) == NULL) goto open_err; + if (err != 0) + goto err_err; + /* Check that various modifications to already-written types are prohibited. */ @@ -145,4 +154,8 @@ main (int argc, char *argv[]) open_err: fprintf (stderr, "%s: cannot open: %s\n", argv[0], ctf_errmsg (err)); return 1; + + err_err: + fprintf (stderr, "%s: open error not set to success on success\n", argv[0]); + return 1; } |