aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-11-15 16:06:57 +0800
committerMilan Crha <mcrha@redhat.com>2013-11-15 16:06:57 +0800
commit570c6374806d0f1ec59cf7a72543efe6b5b637be (patch)
treec5390b1fcb73f30c28bf37168add9bf1dc622b42 /shell
parent1be51f232560f864ba8795a38e55d472b5b0e2b3 (diff)
downloadgsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.gz
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.bz2
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.lz
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.xz
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.zst
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.zip
Fix/mute issues found by Coverity scan
This makes the code free of Coverity scan issues. It is sometimes quite pedantic and expects/suggests some coding habits, thus certain changes may look weird, but for a good thing, I hope. The code is also tagged with Coverity scan suppressions, to keep the code as is and hide the warning too. Also note that Coverity treats g_return_if_fail(), g_assert() and similar macros as unreliable, and it's true these can be disabled during the compile time, thus it brings in other set of 'weird' changes.
Diffstat (limited to 'shell')
-rw-r--r--shell/e-convert-local-mail.c15
-rw-r--r--shell/e-shell-migrate.c11
-rw-r--r--shell/e-shell-utils.c2
-rw-r--r--shell/e-shell-view.c1
-rw-r--r--shell/killev.c3
5 files changed, 24 insertions, 8 deletions
diff --git a/shell/e-convert-local-mail.c b/shell/e-convert-local-mail.c
index 81c9e04771..ab773813d1 100644
--- a/shell/e-convert-local-mail.c
+++ b/shell/e-convert-local-mail.c
@@ -16,8 +16,11 @@
*
*/
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
+#include <errno.h>
#include <glib/gstdio.h>
#include <camel/camel.h>
@@ -168,8 +171,11 @@ rename_mbox_dir (ESource *mbox_source,
g_file_test (old_mail_dir, G_FILE_TEST_EXISTS) &&
!g_file_test (new_mail_dir, G_FILE_TEST_EXISTS);
- if (need_rename)
- g_rename (old_mail_dir, new_mail_dir);
+ if (need_rename) {
+ if (g_rename (old_mail_dir, new_mail_dir) == -1)
+ g_warning ("%s: Failed to rename '%s' to '%s': %s",
+ G_STRFUNC, old_mail_dir, new_mail_dir, g_strerror (errno));
+ }
g_free (old_mail_dir);
g_free (new_mail_dir);
@@ -246,7 +252,9 @@ migrate_mbox_to_maildir (EShell *shell,
path = g_build_filename (data_dir, "local", NULL);
g_object_set (settings, "path", path, NULL);
- g_mkdir (path, 0700);
+ if (g_mkdir (path, 0700) == -1)
+ g_warning ("%s: Failed to make directory '%s': %s",
+ G_STRFUNC, path, g_strerror (errno));
g_free (path);
g_object_unref (settings);
@@ -257,6 +265,7 @@ migrate_mbox_to_maildir (EShell *shell,
ms.complete = FALSE;
thread = g_thread_new (NULL, (GThreadFunc) migrate_stores, &ms);
+ /* coverity[loop_condition] */
while (!ms.complete)
g_main_context_iteration (NULL, TRUE);
diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c
index 20e96960e4..f7de962fde 100644
--- a/shell/e-shell-migrate.c
+++ b/shell/e-shell-migrate.c
@@ -19,12 +19,15 @@
*
*/
-#include "e-shell-migrate.h"
-
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
+
+#include <errno.h>
#include <glib/gstdio.h>
#include <libedataserver/libedataserver.h>
+#include "e-shell-migrate.h"
#include "evo-version.h"
static gboolean
@@ -157,7 +160,9 @@ change_dir_modes (const gchar *path)
g_free (full_path);
}
- g_chmod (path, 0700);
+ if (g_chmod (path, 0700) == -1)
+ g_warning ("%s: Failed to chmod of '%s': %s", G_STRFUNC, path, g_strerror (errno));
+
g_dir_close (dir);
}
diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c
index 97982cfbf9..1c3f8f88c0 100644
--- a/shell/e-shell-utils.c
+++ b/shell/e-shell-utils.c
@@ -156,7 +156,7 @@ e_shell_run_save_dialog (EShell *shell,
gchar **flts = g_strsplit (filters, ";", -1);
gint i;
- for (i = 0; flts[i]; i++) {
+ for (i = 0; flts && flts[i]; i++) {
GtkFileFilter *filter = gtk_file_filter_new ();
gchar *flt = flts[i];
gchar *delim = strchr (flt, ':'), *next = NULL;
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index fe9724c46f..ca5cdb0b62 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -452,6 +452,7 @@ shell_view_get_property (GObject *object,
g_value_set_object (
value, e_shell_view_get_shell_backend (
E_SHELL_VIEW (object)));
+ return;
case PROP_SHELL_CONTENT:
g_value_set_object (
diff --git a/shell/killev.c b/shell/killev.c
index ea4ad2a8ce..2157cdbce8 100644
--- a/shell/killev.c
+++ b/shell/killev.c
@@ -163,7 +163,8 @@ main (gint argc,
kill:
#ifdef KILL_PROCESS_CMD
- system (KILL_PROCESS_CMD " -QUIT evolution 2> /dev/null");
+ if (system (KILL_PROCESS_CMD " -QUIT evolution 2> /dev/null") == -1)
+ g_warning ("%s: Failed to execute: '%s'", G_STRFUNC, KILL_PROCESS_CMD);
#else
g_printerr ("No \"kill\" command available.\n");
#endif