[http] Fix a bug when downloading zip file.

This commit is contained in:
Jiaqiang Xu 2013-02-03 11:26:31 +08:00
parent 8e4efdc166
commit 0ebc3c21e1

View File

@ -243,13 +243,11 @@ write_dir_data_cb (struct bufferevent *bev, void *ctx)
int n;
n = readn (data->zipfd, buf, sizeof(buf));
if (n <= 0) {
if (n < 0) {
seaf_warning ("failed to read zipfile %s\n", data->zipfile);
evhtp_connection_free (evhtp_request_get_connection (data->req));
free_senddir_data (data);
return;
} else {
} else if (n > 0) {
bufferevent_write (bev, buf, n);
data->remain -= n;