projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rename mp3.c to mp3_afh.c and ogg.c to ogg_afh.c
[paraslash.git]
/
net.c
diff --git
a/net.c
b/net.c
index
bf35162
..
d4472c0
100644
(file)
--- a/
net.c
+++ b/
net.c
@@
-189,8
+189,11
@@
int recv_buffer(int fd, char *buf, ssize_t size)
{
int n;
{
int n;
- if ((n = recv_bin_buffer(fd, buf, size - 1)) >= 0)
+ n = recv_bin_buffer(fd, buf, size - 1);
+ if (n >= 0)
buf[n] = '\0';
buf[n] = '\0';
+ else
+ *buf = '\0';
return n;
}
return n;
}
@@
-514,8
+517,8
@@
int recv_pattern(int fd, const char *pattern, size_t bufsize)
goto out;
ret = 1;
out:
goto out;
ret = 1;
out:
- free(buf);
if (ret < 0)
if (ret < 0)
- PARA_NOTICE_LOG("did not receive pattern '%s'\n", buf);
+ PARA_NOTICE_LOG("did not receive pattern '%s'\n", pattern);
+ free(buf);
return ret;
}
return ret;
}