This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: elm 2.5.3 and glibc 2.1.93


Hi-

Elm may be broken. POSIX APIs are not required to "reset" errno when 
a successful return is indicated (unless they specifically say they
do). Thus, elm shouldn't be checking for errno after a sucessful call.

Mark

"H . J . Lu" wrote:
> 
> With glibc 2.1.93, I got
> # elm
> Cannot lock folder - giving up.  Please try again in a few minutes.
> 
> From strace, I got
> 
> open("/var/spool/mail/hjl", O_RDWR)     = 4
> fcntl64(4, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = -1 ENOSYS (Function not implemented)
> fcntl(4, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
> write(1, "\33[?1l\33>", 7^[[?1l^[>)              = 7
> write(1, "\33[24;1H\r\n", 9^[[24;1H^M)            = 9
> write(1, "\33[2J\33[?47l\0338", 12^[[2J^[[?47l^[8)     = 12
> ioctl(0, SNDCTL_TMR_STOP, {B9600 opost isig icanon echo ...}) = 0
> write(2, "Cannot lock folder - giving up. "..., 67Cannot lock folder - giving up.  Please try again in a few minutes.) = 67
> 
> It looks like elm 2.5.3 may check errno even when fcntl returns 0. I
> believe it is a glibc bug. Here is my patch. Someone please double
> check if there are any more functions like that need fix.
> 
> Thanks.
> 
> H.J.
> --- /work/gnu/import/libc/sysdeps/unix/sysv/linux/i386/fcntl.c  Thu Sep  7 08:45:36 2000
> +++ ./fcntl.c   Thu Sep 21 21:15:25 2000
> @@ -50,10 +50,13 @@ __libc_fcntl (int fd, int cmd, ...)
>  # ifdef __NR_fcntl64
>    if (! __have_no_fcntl64)
>      {
> +      int saved_errno = errno;
>        int result = INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
> +
>        if (result >= 0 || errno != ENOSYS)
>         return result;
> 
> +      __set_errno (saved_errno);
>        __have_no_fcntl64 = 1;
>      }
>  # endif

-- 
Mark S. Brown                                                   bmark@us.ibm.com
Senior Technical Staff Member                          512.838.3926  T/L678.3926
IBM RS/6000 AIX System Architecture                        Mark Brown/Austin/IBM
IBM Corporation, Austin, Texas

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]