summaryrefslogtreecommitdiff
path: root/src/anet.c
diff options
context:
space:
mode:
authorMatt Stancliff <matt@genges.com>2015-01-18 16:46:25 -0500
committerMatt Stancliff <matt@genges.com>2015-01-19 14:10:12 -0500
commit53c082ec39fb4daafba09e416279265f20d46006 (patch)
tree93f38d9c337f3cd9109311f3d4255dbe4712bc6b /src/anet.c
parentf704360462640a88975eeb68fd80617921d7c97d (diff)
downloadredis-53c082ec39fb4daafba09e416279265f20d46006.tar.gz
Improve networking type correctness
read() and write() return ssize_t (signed long), not int. For other offsets, we can use the unsigned size_t type instead of a signed offset (since our replication offsets and buffer positions are never negative).
Diffstat (limited to 'src/anet.c')
-rw-r--r--src/anet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/anet.c b/src/anet.c
index 76e9b67ae..0ec5c55a2 100644
--- a/src/anet.c
+++ b/src/anet.c
@@ -391,7 +391,7 @@ int anetUnixNonBlockConnect(char *err, char *path)
* (unless error or EOF condition is encountered) */
int anetRead(int fd, char *buf, int count)
{
- int nread, totlen = 0;
+ ssize_t nread, totlen = 0;
while(totlen != count) {
nread = read(fd,buf,count-totlen);
if (nread == 0) return totlen;
@@ -406,7 +406,7 @@ int anetRead(int fd, char *buf, int count)
* (unless error is encountered) */
int anetWrite(int fd, char *buf, int count)
{
- int nwritten, totlen = 0;
+ ssize_t nwritten, totlen = 0;
while(totlen != count) {
nwritten = write(fd,buf,count-totlen);
if (nwritten == 0) return totlen;