diff options
author | Max Kellermann <max@duempel.org> | 2008-03-26 10:37:06 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-03-26 10:37:06 +0000 |
commit | 33e88ff8f96627920c63b2d05dc16cb7ae15f318 (patch) | |
tree | ef152b410a24afceb409f5cd4aac3415b333e4a8 /src/interface.c | |
parent | c6ceceae8a7f8b592c63086daa8f2269fb71ca08 (diff) | |
download | mpd-33e88ff8f96627920c63b2d05dc16cb7ae15f318.tar.gz mpd-33e88ff8f96627920c63b2d05dc16cb7ae15f318.tar.xz mpd-33e88ff8f96627920c63b2d05dc16cb7ae15f318.zip |
zero is a valid file descriptor
Although it may not happen in mpd code, it is perfectly possible for a
newly allocated file descriptor to be zero. For theoretical
correctness, allow 0.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7194 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/interface.c')
-rw-r--r-- | src/interface.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/interface.c b/src/interface.c index 7dbcd2dc3..9a79f102e 100644 --- a/src/interface.c +++ b/src/interface.c @@ -604,7 +604,7 @@ static void closeAllInterfaces(void) int i; for (i = 0; i < interface_max_connections; i++) { - if (interfaces[i].fd > 0) + if (interfaces[i].fd >= 0) closeInterface(&(interfaces[i])); if (interfaces[i].send_buf) free(interfaces[i].send_buf); @@ -626,7 +626,7 @@ void closeOldInterfaces(void) int i; for (i = 0; i < interface_max_connections; i++) { - if (interfaces[i].fd > 0) { + if (interfaces[i].fd >= 0) { if (interfaces[i].expired) { DEBUG("interface %i: expired\n", i); closeInterface(&(interfaces[i])); @@ -690,7 +690,7 @@ int interfacePrintWithFD(int fd, char *buffer, int buflen) int copylen; Interface *interface; - assert(fd > 0); + assert(fd >= 0); if (i >= interface_max_connections || interfaces[i].fd < 0 || interfaces[i].fd != fd) { |