From 0c532fa783352422d45270df12bee49344a2dc5e Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Tue, 8 Nov 2022 01:42:27 -0500 Subject: [PATCH] scanner: only abort() if there is a bug abort() is for internal errors that indicate bugs, or for catastrophic failures such as out-of-memory. It is not for I/O errors or bad XML files. Signed-off-by: Demi Marie Obenour --- src/scanner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scanner.c b/src/scanner.c index 3cd05d1..5a32340 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -129,7 +129,7 @@ is_dtd_valid(FILE *input, const char *filename) doc = xmlCtxtReadFd(ctx, fd, filename, NULL, 0); if (!doc) { fprintf(stderr, "Failed to read XML\n"); - abort(); + exit(EXIT_FAILURE); } rc = xmlValidateDtd(dtdctx, doc, dtd); @@ -141,7 +141,7 @@ is_dtd_valid(FILE *input, const char *filename) if (lseek(fd, 0, SEEK_SET) != 0) { fprintf(stderr, "Failed to reset fd, output would be garbage.\n"); - abort(); + exit(EXIT_FAILURE); } #endif return rc;