mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "A. Wilcox" <awilfox@adelielinux.org>
To: musl@lists.openwall.com
Cc: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Subject: [PATCH 3/3] getdate: correctly specify error number
Date: Fri,  9 Jun 2017 00:26:18 -0500	[thread overview]
Message-ID: <20170609052618.5875-4-awilfox@adelielinux.org> (raw)
In-Reply-To: <20170609052618.5875-1-awilfox@adelielinux.org>

From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>

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 89f2169..420cd8e 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.10.0



      parent reply	other threads:[~2017-06-09  5:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-05 23:04 The Great Big POSIX Conformance Thread [phase 1] A. Wilcox
2017-02-06  0:01 ` Rich Felker
2017-02-06  0:26   ` A. Wilcox
2017-02-06 22:25   ` A. Wilcox
2017-06-09  5:26     ` POSIX conformance patches (phase 1) A. Wilcox
2017-06-09  5:26       ` [PATCH 1/3] catopen: set errno to EOPNOTSUPP A. Wilcox
2017-06-09  5:26       ` [PATCH 2/3] confstr: don't give empty strings for unset values A. Wilcox
2017-06-15  0:00         ` Rich Felker
2017-06-09  5:26       ` A. Wilcox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170609052618.5875-4-awilfox@adelielinux.org \
    --to=awilfox@adelielinux.org \
    --cc=AWilcox@Wilcox-Tech.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).