Commit e5419d2d authored by vvaltman's avatar vvaltman

Check return code when downloading files

parent ecdec462
...@@ -401,6 +401,11 @@ void parse_config (void) { ...@@ -401,6 +401,11 @@ void parse_config (void) {
tasprintf (&secret_chat_file_name, "%s/%s/%s", get_home_directory (), CONFIG_DIRECTORY, SECRET_CHAT_FILE); tasprintf (&secret_chat_file_name, "%s/%s/%s", get_home_directory (), CONFIG_DIRECTORY, SECRET_CHAT_FILE);
} }
tgl_set_download_directory (downloads_directory); tgl_set_download_directory (downloads_directory);
if (!mkdir (downloads_directory, CONFIG_DIRECTORY_MODE)) {
if (!disable_output) {
printf ("[%s] created\n", downloads_directory);
}
}
} }
#endif #endif
......
...@@ -2415,6 +2415,10 @@ static int download_on_answer (struct query *q) { ...@@ -2415,6 +2415,10 @@ static int download_on_answer (struct query *q) {
struct download *D = q->extra; struct download *D = q->extra;
if (D->fd == -1) { if (D->fd == -1) {
D->fd = open (D->name, O_CREAT | O_WRONLY, 0640); D->fd = open (D->name, O_CREAT | O_WRONLY, 0640);
if (D->fd < 0) {
vlogprintf (E_ERROR, "Can not open for writing: %m\n");
assert (D->fd >= 0);
}
} }
fetch_int (); // mtime fetch_int (); // mtime
int len = prefetch_strlen (); int len = prefetch_strlen ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment