summaryrefslogtreecommitdiff
path: root/src/unexpand.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-09-23 08:01:26 +0000
committerJim Meyering <jim@meyering.net>2003-09-23 08:01:26 +0000
commit46369400c745f255663923b123853436bc94b105 (patch)
tree431f1e194a035ffa498074ad194f7763c13eee6d /src/unexpand.c
parentbac3a335c9f6b8bdc8d05daffe183facca961dd6 (diff)
downloadcoreutils-46369400c745f255663923b123853436bc94b105.tar.xz
(unexpand): Save errno after input error, to report proper errno value.
Diffstat (limited to 'src/unexpand.c')
-rw-r--r--src/unexpand.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/unexpand.c b/src/unexpand.c
index 8ba563a52..ab0b8fb15 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. */