Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/iconv make the error message kindly if the last char...



details:   https://anonhg.NetBSD.org/src/rev/4a8220f1946d
branches:  trunk
changeset: 580479:4a8220f1946d
user:      tshiozak <tshiozak%NetBSD.org@localhost>
date:      Mon Apr 25 13:57:34 2005 +0000

description:
make the error message kindly if the last character is incompleted.
(bin/30051)

diffstat:

 usr.bin/iconv/iconv.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (35 lines):

diff -r 115bbac5e3de -r 4a8220f1946d usr.bin/iconv/iconv.c
--- a/usr.bin/iconv/iconv.c     Mon Apr 25 13:42:04 2005 +0000
+++ b/usr.bin/iconv/iconv.c     Mon Apr 25 13:57:34 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iconv.c,v 1.8 2005/04/24 17:46:06 christos Exp $       */
+/*     $NetBSD: iconv.c,v 1.9 2005/04/25 13:57:34 tshiozak Exp $       */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: iconv.c,v 1.8 2005/04/24 17:46:06 christos Exp $");
+__RCSID("$NetBSD: iconv.c,v 1.9 2005/04/25 13:57:34 tshiozak Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <errno.h>
@@ -134,10 +134,12 @@
                                ret = fread(inbuf + inbytes, 1,
                                    INBUFSIZE - inbytes, fp);
                                if (ret == 0) {
-                                       if (feof(fp)) {
-                                               errno = EINVAL;
-                                               err(EXIT_FAILURE, "iconv()");
-                                       } else
+                                       if (feof(fp))
+                                               errx(EXIT_FAILURE,
+                                                    "unexpected end of file; "
+                                                    "the last character is "
+                                                    "incomplete.");
+                                       else
                                                err(EXIT_FAILURE, "fread()");
                                }
                                in = inbuf;



Home | Main Index | Thread Index | Old Index