commit - 3e36ea51f650498b743754daa74d4aa039129956
commit + ff48dbfd84e86f5a720e9400a7acb53fe3b9393b
blob - 962b33911e4ef1ec30de6c88dbd401440dcf74b2
blob + efd5439c04b3d84b8126422e2a32f276a2f1a3fb
--- telescope.c
+++ telescope.c
stop_tab(tab);
return;
}
-
- ui_show_downloads_pane();
-
- d = enqueue_download(tab->id, path, 0);
/*
* Change this tab id, the old one is associated with the
*/
tab->id = tab_new_id();
- if ((fd = open(path, O_WRONLY|O_TRUNC|O_CREAT, 0644)) == -1)
- message("Can't open file %s: %s", d->path, strerror(errno));
- else if (d->buffer) {
- FILE *fp;
- int r;
+ if ((fd = open(path, O_WRONLY|O_TRUNC|O_CREAT, 0644)) == -1) {
+ message("Can't open file %s: %s", path, strerror(errno));
+ stop_tab(tab);
+ return;
+ }
- if ((fp = fdopen(fd, "w")) != NULL) {
- r = parser_serialize(current_tab, fp);
- if (!r)
- message("Failed to save the page.");
- fclose(fp);
- }
-
- dequeue_first_download();
- } else {
- d->fd = fd;
- ui_send_net(IMSG_PROCEED, d->id, NULL, 0);
- }
+ ui_show_downloads_pane();
+ d = enqueue_download(tab->id, path, 0);
+ d->fd = fd;
+ ui_send_net(IMSG_PROCEED, d->id, NULL, 0);
}
static void