#986048 aux.c: change "sigfile[]" to "sigfile_name[]" and move it to the head of the file to make the name usable in it

Package:
src:nn
Source:
nn
Submitter:
Bjarni Ingi Gislason
Date:
2022-06-29 23:03:03 UTC
Severity:
normal
Tags:
#986048#5
Date:
2021-03-28 16:22:12 UTC
From:
To:
Dear Maintainer,

  The name "sigfile" was also used for a file pointer (FILE *).

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 aux.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/aux.c b/aux.c
index 72f3b6f..a070136 100644
--- a/aux.c
+++ b/aux.c
@@ -48,6 +48,9 @@ int             response_check_pause = 0;	/* time to wait for
 						 * background cmds */
 char           *response_dflt_answer = "send";

+static char     sigfile_name[FILENAME];
+
+
 int aux_sh(article_header *, char *, char *, char *, char *, char *,
            int, int);

@@ -206,7 +209,6 @@ find_signature(void)
 {
     struct passwd  *passwd;
     char           *dotdir;
-    char            sigfile[FILENAME];
     FILE           *fp;

     passwd = getpwuid(getuid());
@@ -215,20 +217,20 @@ find_signature(void)
     dotdir = passwd->pw_dir;

     if (dotdir[0] == '~') {
-	(void) strcpy(sigfile, passwd->pw_dir);
-	(void) strcat(sigfile, &dotdir[1]);
+	(void) strcpy(sigfile_name, passwd->pw_dir);
+	(void) strcat(sigfile_name, &dotdir[1]);
     } else {
-	(void) strcpy(sigfile, dotdir);
+	(void) strcpy(sigfile_name, dotdir);
     }
-    (void) strcat(sigfile, "/");
-    (void) strcat(sigfile, ".signature");
+    (void) strcat(sigfile_name, "/");
+    (void) strcat(sigfile_name, ".signature");

 #ifdef DEBUG
-    fprintf(stderr, "sigfile = '%s'\n", sigfile);
+    fprintf(stderr, "sigfile_name = '%s'\n", sigfile_name);
     sleep(2);
 #endif

-    fp = fopen(sigfile, "r");
+    fp = fopen(sigfile_name, "r");

 #ifdef DEBUG
     if (fp != NULL) {
@@ -274,7 +276,7 @@ append_signature(FILE * sigfile)
     (void) fclose(temp);

 #ifdef DEBUG
-    printf(".signature appended (from %s)\n", sigfile);
+    printf(".signature appended (from %s)\n", sigfile_name);
     sleep(10);
 #endif
 }

#986048#8
Date:
2022-06-12 10:52:27 UTC
From:
To:
Hallo!

Took a long time, but i try now to incoperate your patches.

It looks like you have not provided all patches you've made.

In this patch the context is

which i can't find anywhere.

As your patches are sometimes mixed between fixing compiler warnings, hardening and
adding features and sometimes look like duplicates or out of order in
bugs.debian.org, it would be nice if you just do a full patch between upstream
nn-6.7.3 (http://www.nndev.org/pub/nn-6.7/nn-6.7.3.tar.Z) and your working version.

Thank you,
	Cord