From: Jim Meyering Date: Tue, 23 Sep 2003 08:01:26 +0000 (+0000) Subject: (unexpand): Save errno after input error, to report proper errno value. X-Git-Tag: COREUTILS-5_1_0~551 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46369400c745f255663923b123853436bc94b105;p=platform%2Fupstream%2Fcoreutils.git (unexpand): Save errno after input error, to report proper errno value. --- diff --git a/src/unexpand.c b/src/unexpand.c index 8ba563a..ab0b8fb 100644 --- a/src/unexpand.c +++ b/src/unexpand.c @@ -235,6 +235,7 @@ unexpand (void) int next_tab_column; /* Column the next tab stop is on. */ int convert = 1; /* If nonzero, perform translations. */ unsigned int pending = 0; /* Pending columns of blanks. */ + int saved_errno; fp = next_file ((FILE *) NULL); if (fp == NULL) @@ -246,6 +247,7 @@ unexpand (void) for (;;) { c = getc (fp); + saved_errno = errno; if (c == ' ' && convert && column < TAB_STOP_SENTINEL) { @@ -325,6 +327,7 @@ unexpand (void) if (c == EOF) { + errno = saved_errno; fp = next_file (fp); if (fp == NULL) break; /* No more files. */