diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-03-15 19:39:07 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2016-03-15 19:39:07 +0000 |
commit | 6e3b198d9efa70de98409fbb78b9f83257b2101c (patch) | |
tree | b757fe56d2307ccdf26839e28d317825cc2dd572 /src/exim_monitor | |
parent | c99b02de6c9788335fd4ea1da063248f0265ad91 (diff) |
tidying: coverity issues
Diffstat (limited to 'src/exim_monitor')
-rw-r--r-- | src/exim_monitor/em_log.c | 12 | ||||
-rw-r--r-- | src/exim_monitor/em_main.c | 10 | ||||
-rw-r--r-- | src/exim_monitor/em_menu.c | 18 |
3 files changed, 29 insertions, 11 deletions
diff --git a/src/exim_monitor/em_log.c b/src/exim_monitor/em_log.c index 6efd9c0c9..4d8c29312 100644 --- a/src/exim_monitor/em_log.c +++ b/src/exim_monitor/em_log.c @@ -217,7 +217,11 @@ uschar buffer[log_buffer_len]; if (LOG != NULL) { - fseek(LOG, log_position, SEEK_SET); + if (fseek(LOG, log_position, SEEK_SET)) + { + perror("logfile fseek"); + exit(1); + } while (Ufgets(buffer, log_buffer_len, LOG) != NULL) { @@ -393,7 +397,11 @@ if (LOG == NULL || { if (LOG != NULL) fclose(LOG); LOG = TEST; - fstat(fileno(LOG), &statdata); + if (fstat(fileno(LOG), &statdata)) + { + fprintf(stderr, "fstat %s: %s\n", log_file_open, strerror(errno)); + exit(1); + } log_inode = statdata.st_ino; } } diff --git a/src/exim_monitor/em_main.c b/src/exim_monitor/em_main.c index 69354c086..019bdffda 100644 --- a/src/exim_monitor/em_main.c +++ b/src/exim_monitor/em_main.c @@ -669,8 +669,14 @@ if (log_file[0] != 0) { fseek(LOG, 0, SEEK_END); log_position = ftell(LOG); - fstat(fileno(LOG), &statdata); - log_inode = statdata.st_ino; + if (fstat(fileno(LOG), &statdata)) + { + perror("log file fstat"); + fclose(LOG); + LOG=NULL; + } + else + log_inode = statdata.st_ino; } } else diff --git a/src/exim_monitor/em_menu.c b/src/exim_monitor/em_menu.c index af9ef3701..6975e709d 100644 --- a/src/exim_monitor/em_menu.c +++ b/src/exim_monitor/em_menu.c @@ -273,8 +273,12 @@ if (pipe(pipe_fd) != 0) return; } -fcntl(pipe_fd[0], F_SETFL, O_NONBLOCK); -fcntl(pipe_fd[1], F_SETFL, O_NONBLOCK); +if ( fcntl(pipe_fd[0], F_SETFL, O_NONBLOCK) + || fcntl(pipe_fd[1], F_SETFL, O_NONBLOCK)) + { + perror("set nonblocking on pipe"); + exit(1); + } /* Delivering a message can take some time, and we want to show the output as it goes along. This requires subprocesses and is coded below. For @@ -551,7 +555,7 @@ static void addrecipAction(Widget w, XtPointer client_data, XtPointer call_data) { w = w; /* Keep picky compilers happy */ call_data = call_data; -Ustrcpy(actioned_message, (uschar *)client_data); +Ustrncpy(actioned_message, client_data, 24); action_required = US"-Mar"; dialog_ref_widget = menushell; create_dialog(US"Recipient address to add?", US""); @@ -567,7 +571,7 @@ static void markdelAction(Widget w, XtPointer client_data, XtPointer call_data) { w = w; /* Keep picky compilers happy */ call_data = call_data; -Ustrcpy(actioned_message, (uschar *)client_data); +Ustrncpy(actioned_message, client_data, 24); action_required = US"-Mmd"; dialog_ref_widget = menushell; create_dialog(US"Recipient address to mark delivered?", US""); @@ -582,7 +586,7 @@ static void markalldelAction(Widget w, XtPointer client_data, XtPointer call_dat { w = w; /* Keep picky compilers happy */ call_data = call_data; -ActOnMessage((uschar *)client_data, US"-Mmad", US""); +ActOnMessage(US client_data, US"-Mmad", US""); } @@ -597,9 +601,9 @@ queue_item *q; uschar *sender; w = w; /* Keep picky compilers happy */ call_data = call_data; -Ustrcpy(actioned_message, (uschar *)client_data); +Ustrncpy(actioned_message, client_data, 24); q = find_queue(actioned_message, queue_noop, 0); -sender = (q == NULL)? US"" : (q->sender[0] == 0)? US"<>" : q->sender; +sender = !q ? US"" : q->sender[0] == 0 ? US"<>" : q->sender; action_required = US"-Mes"; dialog_ref_widget = menushell; create_dialog(US"New sender address?", sender); |