blob: e9e48068a995728de8bdf473a29731cc5751d5b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
From 10800088099ec4c27c1db6c613c8bbf9f76e4057 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Fri, 9 Jun 2017 00:26:18 -0500
Subject: [PATCH] getdate: correctly specify error number
POSIX defines getdate error #5 as:
"An I/O error is encountered while reading the template file."
POSIX defines getdate error #7 as:
"There is no line in the template that matches the input."
This change correctly disambiguates between the two error conditions.
---
src/time/getdate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/time/getdate.c b/src/time/getdate.c
index 89f21699..420cd8e4 100644
--- a/src/time/getdate.c
+++ b/src/time/getdate.c
@@ -37,7 +37,8 @@ struct tm *getdate(const char *s)
}
}
- getdate_err = 7;
+ if (ferror(f)) getdate_err = 5;
+ else getdate_err = 7;
out:
if (f) fclose(f);
pthread_setcancelstate(cs, 0);
--
2.13.0
|