Archived
1
0
Fork 0

dlight.c: use buffer_write()

This commit is contained in:
Henrik Hautakoski 2011-11-11 12:23:42 +01:00
parent 4c664f2400
commit 269ddffa78

View file

@ -21,21 +21,8 @@
static int write_http_file(struct http_file *file, const char *dest) {
char path[4096];
int rc, fd;
snprintf(path, sizeof(path), "%s/%s",
dest, file->filename);
fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0664);
if (fd < 0 && errno != EEXIST) {
error("failed to write file: %s", path);
return -1;
}
rc = write(fd, file->data.block, file->data.len);
close(fd);
return rc;
snprintf(path, sizeof(path), "%s/%s", dest, file->filename);
return buffer_write(&file->data, path);
}
static void process_items(rss_t rss, struct target *t) {