#986348 db.c: give the compiler information about the subroutine "nn_exitmsg()" that uses "exit()"

Package:
src:nn
Source:
nn
Submitter:
Bjarni Ingi Gislason
Date:
2021-04-03 23:27:04 UTC
Severity:
normal
Tags:
#986348#5
Date:
2021-04-03 23:24:21 UTC
From:
To:
Dear Maintainer,

  "nn_exitmsg()" exits the program, so the compiler does not know that
when analyzing execution paths.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 db.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/db.c b/db.c
index c55fa3f..15a9372 100644
--- a/db.c
+++ b/db.c
@@ -1039,6 +1039,8 @@ readactfile(void)

     if (actfp == NULL) {
 	nn_exitmsg(1, "could not fetch active file from %s\n", source);
+/* Give the compiler information about the exit of the previous line */
+	exit(1);
     }

     /*
@@ -1075,6 +1077,8 @@ readactfile(void)

 	if (stnew == NULL) {
 	    nn_exitmsg(1, "Out of memory for active file (at line %d)\n", count + 1);
+/* Give the compiler information about the exit of the previous line */
+	    exit(1);
 	}

 	if (sthead != NULL) {
@@ -1097,6 +1101,8 @@ readactfile(void)
     if (grplist == NULL) {
 	nn_exitmsg(1, "can't create active or group list (%d entries)\n",
 		   count + 1);
+/* Give the compiler information about the exit of the previous line */
+	exit(1);
     }

     /*
@@ -1150,6 +1156,8 @@ readpartactfile(void)

     if (actfp == NULL) {
 	nn_exitmsg(1, "could not open .newsrc file %s\n", newsrc_file);
+/* Give the compiler information about the exit of the previous line */
+	exit(1);
     }

     /*
@@ -1196,6 +1204,8 @@ readpartactfile(void)
 	stlist_t *stnew = (stlist_t *) strkeep(actline, sizeof(stlisthdr_t), POOL_ACT);
 	if (stnew == NULL) {
 	    nn_exitmsg(1, "Out of memory for active file (at line %d)\n", count + 1);
+/* Give the compiler information about the exit of the previous line */
+	    exit(1);
 	}
 	if (sthead != NULL) {
 	    stp->n.next = stnew;
@@ -1399,6 +1409,8 @@ readtimfile(void)
     timtbl = hashcreate(hsize, (unsigned (*) ()) NULL);
     if (timtbl == NULL) {
 	nn_exitmsg(1, "can't create time hash (%d entries)\n", hsize);
+/* Give the compiler information about the exit of the previous line */
+	exit(1);
     }

     if (new_group_action == RCX_NEVER)
@@ -1439,6 +1451,8 @@ readtimfile(void)
 	*p++ = NUL;
 	if (!hashstore(timtbl, line, p)) {
 	    nn_exitmsg(1, "nn: time hashstore failed\n");
+/* Give the compiler information about the exit of the previous line */
+	    exit(1);
 	}
 	count++;
     }
@@ -1649,6 +1663,9 @@ db_init_group(register group_header * gh, int num)
 	gh->group_name = grplist[num];
 	if (gh->group_name == NULL) {
 	    nn_exitmsg(1, "can't map group %d to name\n", num);
+/* Give the compiler information about the exit of the previous line */
+	    exit(1);
+
 	}
 	gh->group_name_length = strlen(gh->group_name);
     }