Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From 6870dd7c11a62bf6713b0c0dc2790a2f8207bc11 Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Sat, 3 Apr 2021 22:59:32 +0000
>Subject: [PATCH] db.c: give the compiler information about the subroutine
> "nn_exitmsg()" that uses "exit()"

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

Signed-off-by: Bjarni Ingi Gislason <bjarn...@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);
     }
-- 
2.30.2

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.24-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to