mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 13:23:44 +00:00
2005-02-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* network.c: (set_nonblocking) Should check return code from fcntl(F_GETFL).
This commit is contained in:
parent
a269d613fe
commit
42218e7125
@ -1,3 +1,8 @@
|
||||
2005-02-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||
|
||||
* network.c: (set_nonblocking) Should check return code from
|
||||
fcntl(F_GETFL).
|
||||
|
||||
2005-02-15 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||
|
||||
* network.h: Declare new function set_nonblocking. Indicate that
|
||||
|
@ -75,7 +75,17 @@ writen(int fd, const u_char *ptr, int nbytes)
|
||||
int
|
||||
set_nonblocking(int fd)
|
||||
{
|
||||
if (fcntl(fd, F_SETFL, (fcntl(fd, F_GETFL) | O_NONBLOCK)) < 0)
|
||||
int flags;
|
||||
|
||||
/* According to the Single UNIX Spec, the return value for F_GETFL should
|
||||
never be negative. */
|
||||
if ((flags = fcntl(fd, F_GETFL)) < 0)
|
||||
{
|
||||
zlog_warn("fcntl(F_GETFL) failed for fd %d: %s",
|
||||
fd, safe_strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (fcntl(fd, F_SETFL, (flags | O_NONBLOCK)) < 0)
|
||||
{
|
||||
zlog_warn("fcntl failed setting fd %d non-blocking: %s",
|
||||
fd, safe_strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user