about summary refs log tree commit diff
path: root/src/time
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2017-06-09 00:26:18 -0500
committerRich Felker <dalias@aerifal.cx>2017-06-14 19:50:58 -0400
commit10800088099ec4c27c1db6c613c8bbf9f76e4057 (patch)
treec4a6978a0806d91991af2a63fba384b4afae5722 /src/time
parentaf0517301677b4206c605caaef25f5d57a31b5b8 (diff)
downloadmusl-10800088099ec4c27c1db6c613c8bbf9f76e4057.tar.gz
musl-10800088099ec4c27c1db6c613c8bbf9f76e4057.tar.xz
musl-10800088099ec4c27c1db6c613c8bbf9f76e4057.zip
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.
Diffstat (limited to 'src/time')
-rw-r--r--src/time/getdate.c3
1 files changed, 2 insertions, 1 deletions
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);