[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sharutils-4.3.61 (test release)
From: |
Paul Eggert |
Subject: |
Re: sharutils-4.3.61 (test release) |
Date: |
Mon, 1 Jul 2002 23:45:35 -0700 (PDT) |
> From: Karl Eichwalder <address@hidden>
> Date: Tue, 02 Jul 2002 06:18:11 +0200
>
> http://www.iro.umontreal.ca/~eichwalk/sharutils/sharutils-4.3.61.tar.bz2
This one builds on Solaris; thanks!
The Sun C compiler found an infelicity in the code: a loop of the form
while (n != 0)
{
[some code goes here];
break;
}
that did not modify `n'. This should be `if (n != 0)'.
Also, I noticed that the code did not check for I/O error when closing
input or output; this needs to be done since the errors might be
buffered. (There is a similar problem with uudecode but I've run out
of time tonight; sorry.) Patch enclosed below.
2002-07-01 Paul Eggert <address@hidden>
* src/uuencode.c (encode): Change 'while' to 'if' to clean up the
code a bit, and to silence a warning from the Sun C compiler.
Check for I/O error when closing input and output.
diff -pru sharutils-4.3.61/src/uuencode.c sharutils-4.3.61-fix/src/uuencode.c
--- sharutils-4.3.61/src/uuencode.c 2002-06-27 11:57:55.000000000 -0700
+++ sharutils-4.3.61-fix/src/uuencode.c 2002-07-01 23:14:47.956638000 -0700
@@ -163,20 +163,18 @@ encode ()
break;
}
- while (n != 0)
+ if (n != 0)
{
char c1 = *p;
char c2 = n == 1 ? 0 : p[1];
ch = c1 >> 2;
ch = ENC (ch);
- if (putchar (ch) == EOF)
- break;
+ putchar (ch);
ch = ((c1 << 4) & 060) | ((c2 >> 4) & 017);
ch = ENC (ch);
- if (putchar (ch) == EOF)
- break;
+ putchar (ch);
if (n == 1)
ch = trans_ptr == uu_std ? ENC ('\0') : '=';
@@ -185,17 +183,16 @@ encode ()
ch = (c2 << 2) & 074;
ch = ENC (ch);
}
- if (putchar (ch) == EOF)
- break;
+ putchar (ch);
ch = trans_ptr == uu_std ? ENC ('\0') : '=';
- if (putchar (ch) == EOF)
- break;
+ putchar (ch);
putchar ('\n');
- break;
}
if (ferror (stdin))
error (EXIT_FAILURE, 0, _("Read error"));
+ if (fclose (stdin) != 0)
+ error (EXIT_FAILURE, errno, _("Read error"));
if (trans_ptr == uu_std)
{
putchar (ENC ('\0'));
@@ -303,5 +300,7 @@ choke me - Must translate mode argument
printf (trans_ptr == uu_std ? "end\n" : "====\n");
if (ferror (stdout))
error (EXIT_FAILURE, 0, _("Write error"));
+ if (fclose (stdout) != 0)
+ error (EXIT_FAILURE, errno, _("Write error"));
exit (EXIT_SUCCESS);
}
- Re: sharutils-4.3.60 (test release), Karl Eichwalder, 2002/07/01
- Re: sharutils-4.3.60 (test release), Paul Eggert, 2002/07/01
- sharutils-4.3.60 incompatibility with strict C89, Paul Eggert, 2002/07/01
- sharutils-4.3.60 "make check" umask problem and version mismatch, Paul Eggert, 2002/07/01
- sharutils-4.3.60 incompatibilities with POSIX 1003.1-2001, Paul Eggert, 2002/07/01
- Re: sharutils-4.3.61 (test release), Karl Eichwalder, 2002/07/02