summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfeed.c2
-rw-r--r--sfeed_frames.c5
-rw-r--r--sfeed_html.c4
-rw-r--r--sfeed_plain.c4
-rw-r--r--sfeed_stats.c4
5 files changed, 17 insertions, 2 deletions
diff --git a/sfeed.c b/sfeed.c
index f7fdb82..70ab46a 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -188,7 +188,7 @@ entitytostr(const char *e, char *buffer, size_t bufsiz) {
l = strtoul(e + 1, NULL, 16); /* hex */
else
l = strtoul(e, NULL, 10); /* decimal */
- if(errno != 0 || !l)
+ if(errno != 0)
return 0; /* invalid value */
if(!(len = codepointtoutf8(l, &cp)))
return 0;
diff --git a/sfeed_frames.c b/sfeed_frames.c
index 8496311..683f9e0 100644
--- a/sfeed_frames.c
+++ b/sfeed_frames.c
@@ -7,8 +7,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <utime.h>
-#include <errno.h>
#include <limits.h>
+#include <errno.h>
#include "util.h"
@@ -216,7 +216,10 @@ main(int argc, char **argv) {
}
/* write item. */
+ errno = 0;
parsedtime = (time_t)strtol(fields[FieldUnixTimestamp], NULL, 10);
+ if(errno != 0)
+ parsedtime = 0;
/* set modified and access time of file to time of item. */
contenttime.actime = parsedtime;
contenttime.modtime = parsedtime;
diff --git a/sfeed_html.c b/sfeed_html.c
index afd3e4c..8ba798b 100644
--- a/sfeed_html.c
+++ b/sfeed_html.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
+#include <errno.h>
#include "util.h"
@@ -50,7 +51,10 @@ main(void) {
feeds = fcur;
while(parseline(&line, &size, fields, FieldLast, '\t', stdin) > 0) {
+ errno = 0;
parsedtime = (time_t)strtol(fields[FieldUnixTimestamp], NULL, 10);
+ if(errno != 0)
+ parsedtime = 0;
isnew = (parsedtime >= comparetime) ? 1 : 0;
islink = (fields[FieldLink][0] != '\0') ? 1 : 0;
/* first of feed section or new feed section. */
diff --git a/sfeed_plain.c b/sfeed_plain.c
index ca5756b..f57a8c8 100644
--- a/sfeed_plain.c
+++ b/sfeed_plain.c
@@ -2,6 +2,7 @@
#include <string.h>
#include <stdlib.h>
#include <time.h>
+#include <errno.h>
#include "util.h"
@@ -27,7 +28,10 @@ main(void) {
comparetime = time(NULL) - (3600 * 24); /* 1 day is old news */
while(parseline(&line, &size, fields, FieldLast, '\t', stdin) > 0) {
+ errno = 0;
parsedtime = (time_t)strtol(fields[FieldUnixTimestamp], NULL, 10);
+ if(errno != 0)
+ parsedtime = 0;
if(parsedtime >= comparetime)
fputs(" N ", stdout);
else
diff --git a/sfeed_stats.c b/sfeed_stats.c
index 3773e4a..a750dc1 100644
--- a/sfeed_stats.c
+++ b/sfeed_stats.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
+#include <errno.h>
#include "util.h"
@@ -40,7 +41,10 @@ main(void) {
feeds = fcur;
while(parseline(&line, &size, fields, FieldLast, '\t', stdin) > 0) {
+ errno = 0;
parsedtime = (time_t)strtol(fields[FieldUnixTimestamp], NULL, 10);
+ if(errno != 0)
+ parsedtime = 0;
isnew = (parsedtime >= comparetime) ? 1 : 0;
/* first of feed section or new feed section. */
if(!totalfeeds || (fcur && strcmp(fcur->name, fields[FieldFeedName]))) {