PERFORCE change 144083 for review
Gabor Kovesdan
gabor at FreeBSD.org
Wed Jun 25 10:45:05 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=144083
Change 144083 by gabor at gabor_server on 2008/06/25 10:44:04
- Check EILSEQ when dealing with wide chars and return 1, when
EILSEQ is triggered.
Suggested by: ache
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/grep/file.c#12 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/grep/file.c#12 (text+ko) ====
@@ -38,6 +38,7 @@
#include <bzlib.h>
#include <err.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -65,8 +66,12 @@
if (fseek(f->f, 0L, SEEK_SET) == -1)
return (0);
- for (i = 0; (i <= BUFSIZ) && (ch != WEOF); i++) {
- ch = fgetwc(f->f);
+ for (i = 0; i <= BUFSIZ; i++) {
+ if ((ch = fgetwc(f->f)) == WEOF) {
+ if (errno == EILSEQ)
+ ret = 1;
+ break;
+ }
if (iswbinary(ch)) {
ret = 1;
break;
More information about the p4-projects
mailing list