[PATCH 4/8] raop: Fix gcc-7 warnings, EWOULDBLOCK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



EAGAIN is used allover the code rather than EWOULDBLOCK
POSIX allows EAGAIN and EWOULDBLOCK to have the same value (and in fact it is)
don't check for EWOULDBLOCK

modules/raop/raop-client.c: In function â??send_udp_audio_packetâ??:
modules/raop/raop-client.c:473:41: warning: logical â??orâ?? of equal expressions [-Wlogical-op]
     if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                         ^~
modules/raop/raop-client.c: In function â??resend_udp_audio_packetsâ??:
modules/raop/raop-client.c:528:45: warning: logical â??orâ?? of equal expressions [-Wlogical-op]
         if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                             ^~

Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
---
 src/modules/raop/raop-client.c | 4 ++--
 src/pulsecore/iochannel.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/modules/raop/raop-client.c b/src/modules/raop/raop-client.c
index ae950f7..24bec3e 100644
--- a/src/modules/raop/raop-client.c
+++ b/src/modules/raop/raop-client.c
@@ -470,7 +470,7 @@ static ssize_t send_udp_audio_packet(pa_raop_client *c, pa_memchunk *block, size
     buffer += packet->index;
     if (buffer && packet->length > 0)
         written = pa_write(c->udp_sfd, buffer, packet->length, NULL);
-    if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
+    if (written < 0 && errno == EAGAIN) {
         pa_log_debug("Discarding UDP (audio, seq=%d) packet due to EAGAIN (%s)", c->seq, pa_cstrerror(errno));
         written = packet->length;
     }
@@ -525,7 +525,7 @@ static ssize_t resend_udp_audio_packets(pa_raop_client *c, uint16_t seq, uint16_
 
         if (buffer && packet->length > 0)
             written = pa_write(c->udp_cfd, buffer, packet->length, NULL);
-        if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
+        if (written < 0 && errno == EAGAIN) {
             pa_log_debug("Discarding UDP (audio-restransmitted, seq=%d) packet due to EAGAIN", seq + i);
             pa_memblock_release(packet->memblock);
             continue;
diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c
index 8973375..e25824b 100644
--- a/src/pulsecore/iochannel.c
+++ b/src/pulsecore/iochannel.c
@@ -227,7 +227,7 @@ ssize_t pa_iochannel_write(pa_iochannel*io, const void*data, size_t l) {
         return r; /* Fast path - we almost always successfully write everything */
 
     if (r < 0) {
-        if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
+        if (errno == EINTR || errno == EAGAIN)
             r = 0;
         else
             return r;
-- 
2.7.4



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux