public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andreas Schwab <schwab@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] iconv: restore verbosity with unrecognized encoding names (bug 30694)
Date: Wed,  2 Aug 2023 11:30:24 +0000 (GMT)	[thread overview]
Message-ID: <20230802113024.19F9F3858D1E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fc72b6d7d818ab2868920af956d1542d03342a4d

commit fc72b6d7d818ab2868920af956d1542d03342a4d
Author: Andreas Schwab <schwab@suse.de>
Date:   Tue Aug 1 17:01:37 2023 +0200

    iconv: restore verbosity with unrecognized encoding names (bug 30694)
    
    Commit 91927b7c76 ("Rewrite iconv option parsing [BZ #19519]") changed the
    iconv program to call __gconv_open directly instead of the iconv_open
    wrapper, but the former does not set errno.  Update the caller to
    interpret the return codes like iconv_open does.

Diff:
---
 iconv/iconv_prog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
index bee898c63c..cf32cf9b44 100644
--- a/iconv/iconv_prog.c
+++ b/iconv/iconv_prog.c
@@ -187,7 +187,7 @@ main (int argc, char *argv[])
 
       if (res != __GCONV_OK)
 	{
-	  if (errno == EINVAL)
+	  if (res == __GCONV_NOCONV || res == __GCONV_NODB)
 	    {
 	      /* Try to be nice with the user and tell her which of the
 		 two encoding names is wrong.  This is possible because

                 reply	other threads:[~2023-08-02 11:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230802113024.19F9F3858D1E@sourceware.org \
    --to=schwab@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).