[Date Prev][Date Next] [Chronological] [Thread] [Top]

read() doesn't return in ber_filbuf() if interrupted (ITS#1658)



Full_Name: Xiaopeng Zhao
Version: 3.3
OS: Digital UNIX
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (216.35.200.107)


Hi, folks,

In lber library (io.c), there is code like this in ber_filbuf()
...
                while ((rc = read( sb->sb_sd, sb->sb_ber.ber_buf,
                                   ((sb->sb_options & LBER_NO_READ_AHEAD) &&
                                   (len < READBUFSIZ)) ?
                                   len : READBUFSIZ )) == -1 &&
               (errno == EAGAIN || errno == EINTR));

My problem is when read() is interrupted by a signal, errno is set to EINTR, the
read() will keep looping in the while loop. Why do we need to check errno==EINTR
here? 

I saw the line 
  (errno == EAGAIN || errno == EINTR))
has been removed in the latest release of ber lib. Is it the fix to similar
problem?

Thanks