From 97df01b534ac5616f39c1a1ffff8fc8e3e7927f9 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Tue, 3 Nov 2020 19:28:19 +0100 Subject: Return failure if import skips any item Other items may have been imported succesfully. Adresses Github issue #323, last part. Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/io.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/io.c') diff --git a/src/io.c b/src/io.c index 43c9b28..cd9b389 100644 --- a/src/io.c +++ b/src/io.c @@ -1277,7 +1277,7 @@ static FILE *get_import_stream(enum import_type type, char **stream_name) * A temporary log file is created in /tmp to store the import process report, * and is cleared at the end. */ -void io_import_data(enum import_type type, char *stream_name, +int io_import_data(enum import_type type, char *stream_name, const char *fmt_ev, const char *fmt_rev, const char *fmt_apt, const char *fmt_rapt, const char *fmt_todo) @@ -1312,7 +1312,7 @@ void io_import_data(enum import_type type, char *stream_name, } if (stream == NULL) - return; + return 0; memset(&stats, 0, sizeof stats); @@ -1320,7 +1320,7 @@ void io_import_data(enum import_type type, char *stream_name, if (log == NULL) { if (stream != stdin) file_close(stream, __FILE_POS__); - return; + return 0; } if (type == IO_IMPORT_ICAL) @@ -1377,8 +1377,11 @@ void io_import_data(enum import_type type, char *stream_name, mem_free(stats_str[3]); if (ui_mode == UI_CURSES) mem_free(stream_name); - if (!stats.skipped) + if (!stats.skipped) { io_log_free(log); + return 1; + } else + return 0; } struct io_file *io_log_init(void) -- cgit v1.2.3-54-g00ecf