#984722 save.c: define _POSIX_C_SOURCE and change a type for a cast

Package:
src:nn
Source:
nn
Submitter:
Bjarni Ingi Gislason
Date:
2021-03-07 17:12:03 UTC
Severity:
normal
Tags:
#984722#5
Date:
2021-03-07 17:10:25 UTC
From:
To:
Dear Maintainer,

  Define _POSIX_C_SOURCE for "popen()" and "pclose()".

  Change type "fct_type" to "fct_type_int" for "NULL" as the last
argument to "next_header_field()".

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

diff --git a/save.c b/save.c
index 38f07a9..b276de6 100644
--- a/save.c
+++ b/save.c
@@ -5,6 +5,11 @@
  *	Save (or print) articles
  */

+/* feature_test_macros(7) for "popen()" and "pclose()"; are in <stdio.h> */
+#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 200809L
+#endif
+
 #include <unistd.h>
 #include <signal.h>
 #include <errno.h>
@@ -581,7 +586,7 @@ save(article_header * ah)
     } else if (mode == SHORT_HEADER || mode == SHORT_HEADER_DG) {
 	char           *name, *val;
 	scan_header_fields(short_header_lines, ah);
-	while (next_header_field(&name, &val, (fct_type *) NULL)) {
+	while (next_header_field(&name, &val, (fct_type_int *) NULL)) {
 	    if (name == NULL)
 		continue;
 	    fprintf(save_file, "%s: %s\n", name, val);