commit f7a4160d3fad90f7d78c6a7a79f3bc74e09f29bb
parent 3b537abbd3e6442e904efce902cb4d22678eab1d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue, 10 Mar 2020 18:03:24 +0100
sfeed_web: fix exit status code
- Fix a theoretical issue where "found" can overflow and return a zero exit
  status when there are many feeds found.
- When there are no RSS/Atom feeds this is not an error, so return 0.
- Style: change unsigned int to int.
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sfeed_web.c b/sfeed_web.c
@@ -10,7 +10,7 @@
 #define STRP(s) s,sizeof(s)-1
 
 static XMLParser parser;
-static unsigned int isbase, islink, isfeedlink, found;
+static int isbase, islink, isfeedlink;
 static char abslink[4096], feedlink[4096], basehref[4096], feedtype[256];
 
 static void
@@ -45,7 +45,6 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort)
 	putchar('\t');
 	printfeedtype(feedtype, stdout);
 	putchar('\n');
-	found++;
 }
 
 static void
@@ -85,5 +84,5 @@ main(int argc, char *argv[])
 	/* NOTE: getnext is defined in xml.h for inline optimization */
 	xml_parse(&parser);
 
-	return found > 0 ? 0 : 1;
+	return 0;
 }