mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
Remove a few #ifdef EWOULDBLOCk
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
6a1c51ee80
commit
fb9067c789
@ -84,11 +84,7 @@ static ssize_t default_sys_recvfile(int fromfd,
|
||||
read_ret = read(fromfd, buffer, toread);
|
||||
} while (read_ret == -1 && errno == EINTR);
|
||||
|
||||
#if defined(EWOULDBLOCK)
|
||||
if (read_ret == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
|
||||
#else
|
||||
if (read_ret == -1 && (errno == EAGAIN)) {
|
||||
#endif
|
||||
/*
|
||||
* fromfd socket is in non-blocking mode.
|
||||
* If we already read some and wrote
|
||||
@ -209,11 +205,7 @@ ssize_t sys_recvfile(int fromfd,
|
||||
return default_sys_recvfile(fromfd, tofd,
|
||||
offset, count);
|
||||
}
|
||||
#if defined(EWOULDBLOCK)
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
#else
|
||||
if (errno == EAGAIN) {
|
||||
#endif
|
||||
/*
|
||||
* fromfd socket is in non-blocking mode.
|
||||
* If we already read some and wrote
|
||||
|
@ -59,11 +59,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
|
||||
ssize_t nwritten;
|
||||
do {
|
||||
nwritten = sendfile(tofd, fromfd, &offset, total);
|
||||
#if defined(EWOULDBLOCK)
|
||||
} while (nwritten == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
|
||||
#else
|
||||
} while (nwritten == -1 && (errno == EINTR || errno == EAGAIN));
|
||||
#endif
|
||||
if (nwritten == -1) {
|
||||
if (errno == ENOSYS || errno == EINVAL) {
|
||||
/* Ok - we're in a world of pain here. We just sent
|
||||
@ -139,11 +135,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
|
||||
xferred = 0;
|
||||
|
||||
nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
|
||||
#if defined(EWOULDBLOCK)
|
||||
if (nwritten == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) {
|
||||
#else
|
||||
if (nwritten == -1 && (errno == EINTR || errno == EAGAIN)) {
|
||||
#endif
|
||||
if (xferred == 0)
|
||||
continue; /* Nothing written yet. */
|
||||
else
|
||||
@ -213,11 +205,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
|
||||
|
||||
do {
|
||||
nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
|
||||
#if defined(EWOULDBLOCK)
|
||||
} while (nwritten == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
|
||||
#else
|
||||
} while (nwritten == -1 && (errno == EINTR || errno == EAGAIN));
|
||||
#endif
|
||||
if (nwritten == -1)
|
||||
return -1;
|
||||
if (nwritten == 0)
|
||||
@ -282,11 +270,7 @@ ssize_t sys_sendfile(int tofd, int fromfd,
|
||||
#else
|
||||
ret = sendfile(fromfd, tofd, offset, count, &sf_header, &nwritten, 0);
|
||||
#endif
|
||||
#if defined(EWOULDBLOCK)
|
||||
if (ret == -1 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) {
|
||||
#else
|
||||
if (ret == -1 && errno != EINTR && errno != EAGAIN) {
|
||||
#endif
|
||||
/* Send failed, we are toast. */
|
||||
return -1;
|
||||
}
|
||||
@ -364,11 +348,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
|
||||
*/
|
||||
do {
|
||||
ret = send_file(&tofd, &hdtrl, 0);
|
||||
#if defined(EWOULDBLOCK)
|
||||
} while ((ret == 1) || (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)));
|
||||
#else
|
||||
} while ((ret == 1) || (ret == -1 && (errno == EINTR || errno == EAGAIN)));
|
||||
#endif
|
||||
if ( ret == -1 )
|
||||
return -1;
|
||||
}
|
||||
|
@ -62,11 +62,8 @@ ssize_t sys_read(int fd, void *buf, size_t count)
|
||||
|
||||
do {
|
||||
ret = read(fd, buf, count);
|
||||
#if defined(EWOULDBLOCK)
|
||||
} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
|
||||
#else
|
||||
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -80,11 +77,8 @@ ssize_t sys_write(int fd, const void *buf, size_t count)
|
||||
|
||||
do {
|
||||
ret = write(fd, buf, count);
|
||||
#if defined(EWOULDBLOCK)
|
||||
} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
|
||||
#else
|
||||
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -109,11 +103,8 @@ ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt)
|
||||
|
||||
do {
|
||||
ret = writev(fd, iov, iovcnt);
|
||||
#if defined(EWOULDBLOCK)
|
||||
} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
|
||||
#else
|
||||
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -159,11 +150,8 @@ ssize_t sys_send(int s, const void *msg, size_t len, int flags)
|
||||
|
||||
do {
|
||||
ret = send(s, msg, len, flags);
|
||||
#if defined(EWOULDBLOCK)
|
||||
} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
|
||||
#else
|
||||
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -246,9 +246,7 @@ static void unix_dgram_recv_handler(struct poll_watch *w, int fd, short events,
|
||||
received = recvmsg(fd, &msg, 0);
|
||||
if (received == -1) {
|
||||
if ((errno == EAGAIN) ||
|
||||
#ifdef EWOULDBLOCK
|
||||
(errno == EWOULDBLOCK) ||
|
||||
#endif
|
||||
(errno == EINTR) || (errno == ENOMEM)) {
|
||||
/* Not really an error - just try again. */
|
||||
return;
|
||||
@ -496,11 +494,7 @@ static int unix_dgram_send(struct unix_dgram_ctx *ctx,
|
||||
if (ret >= 0) {
|
||||
return 0;
|
||||
}
|
||||
#ifdef EWOULDBLOCK
|
||||
if ((errno != EWOULDBLOCK) && (errno != EAGAIN) && (errno != EINTR)) {
|
||||
#else
|
||||
if ((errno != EAGAIN) && (errno != EINTR)) {
|
||||
#endif
|
||||
return errno;
|
||||
}
|
||||
|
||||
|
@ -467,12 +467,9 @@ ssize_t vfs_pwrite_data(struct smb_request *req,
|
||||
fsp,
|
||||
offset + total,
|
||||
N - total);
|
||||
#if defined(EWOULDBLOCK)
|
||||
if (ret == 0 || (ret == -1 &&
|
||||
(errno == EAGAIN || errno == EWOULDBLOCK))) {
|
||||
#else /* EWOULDBLOCK */
|
||||
if (ret == 0 || (ret == -1 && errno == EAGAIN)) {
|
||||
#endif /* EWOULDBLOCK */
|
||||
(errno == EAGAIN ||
|
||||
errno == EWOULDBLOCK))) {
|
||||
int old_flags;
|
||||
/* Ensure the socket is blocking. */
|
||||
old_flags = fcntl(sockfd, F_GETFL, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user