while ((l = knet_read(fp_remote, buf, buf_size)) != 0)
if (fwrite(buf, 1, l, fp) < l) {
fprintf(stderr, "[download_from_remote] fail to write to destination file.\n");
while ((l = knet_read(fp_remote, buf, buf_size)) != 0)
if (fwrite(buf, 1, l, fp) < l) {
fprintf(stderr, "[download_from_remote] fail to write to destination file.\n");