Check return code when downloading files
This commit is contained in:
parent
ecdec4620d
commit
e5419d2da6
5
main.c
5
main.c
@ -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) {
|
|||||||
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 ();
|
||||||
|
Loading…
Reference in New Issue
Block a user