On Wed, Sep 29, 1999 at 12:49:29AM -0400, John Whitley wrote:
> 
> >[strace log elided...]
> 
> The strace is not terribly useful.  I have already reported this
> problem, including a working patch, and been ack'ed by the maintainer.
> The fix was supposed to appear in 2.1-2, but hasn't shown up at all.
> If you are still having this problem, submit it to the BTS, to get things
> rolling on this fix.
> 
> The problem is that anacron expects the return value of getopt() to be 
> EOF instead of the proper libc6 compliant value of -1.  I.e. there is
> a while loop in main.c of the form:
> 
> while ((opt = getopt(...stuff..)) != EOF)
> {
>  ...
> }
> 
> that hangs because getopt _never_ returns EOF under libc6.

Not QUITE right.  I'm really annoyed to see this bug resurfacing again.

The return type of getopt is an int, but people traditionally only
define opt as a char.  This works on ix86 becase EOF (-1) can be a
signed char value.  But char is by default unsigned on powerpc.

Compile it with warnings enabled for a perfectly good explanation.

The most correct fix is to make opt an int.


Notice the text in <stdio.h>:

/* End of file character.
   Some things throughout the library rely on this being -1.  */
#ifndef EOF
# define EOF (-1)
#endif


Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         [EMAIL PROTECTED]         |  |       [EMAIL PROTECTED]      |
\--------------------------------/  \--------------------------------/

Reply via email to