[Commits] [SCM] claws branch, master, updated. 3.10.1-116-g45a6494

ticho at claws-mail.org ticho at claws-mail.org
Mon Jun 30 21:04:21 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  45a6494a22ca888132efbf5f2096e57fd0fb1970 (commit)
      from  fa7987cbb02b09596019d1100604f16c08344528 (commit)

Summary of changes:
 src/plugins/rssyl/libfeed/feed.h   |    2 +-
 src/plugins/rssyl/libfeed/parser.c |    2 +-
 src/plugins/rssyl/opml_export.c    |   12 ++++++++++--
 src/plugins/rssyl/opml_import.c    |    9 +++++++--
 src/plugins/rssyl/rssyl.c          |    2 +-
 src/plugins/rssyl/rssyl_add_item.c |   21 ++++++++++++---------
 src/plugins/rssyl/rssyl_deleted.c  |   13 +++++++++----
 7 files changed, 41 insertions(+), 20 deletions(-)


- Log -----------------------------------------------------------------
commit 45a6494a22ca888132efbf5f2096e57fd0fb1970
Author: Andrej Kacian <andrej at kacian.sk>
Date:   Sun Jun 29 21:39:54 2014 +0200

    RSSyl: Fix some more issues reported by Coverity.

diff --git a/src/plugins/rssyl/libfeed/feed.h b/src/plugins/rssyl/libfeed/feed.h
index 5960133..15ce456 100644
--- a/src/plugins/rssyl/libfeed/feed.h
+++ b/src/plugins/rssyl/libfeed/feed.h
@@ -107,7 +107,7 @@ gboolean feed_insert_item(Feed *feed, FeedItem *item, gint pos);
 
 guint feed_update(Feed *feed, time_t last_update);
 
-#define FILL(n)		{ g_free(n); n = g_strdup(text); } while(0);
+#define FILL(n)		do { g_free(n); n = g_strdup(text); } while(0);
 
 #include "feeditem.h"
 
diff --git a/src/plugins/rssyl/libfeed/parser.c b/src/plugins/rssyl/libfeed/parser.c
index 1ebc412..bb0bb0d 100644
--- a/src/plugins/rssyl/libfeed/parser.c
+++ b/src/plugins/rssyl/libfeed/parser.c
@@ -164,7 +164,7 @@ gchar *feed_parser_get_attribute_value(const gchar **attr, const gchar *name)
 {
 	guint i;
 
-	if( attr == NULL && name == NULL )
+	if( attr == NULL || name == NULL )
 		return NULL;
 
 	for( i = 0; attr[i] != NULL && attr[i+1] != NULL; i += 2 ) {
diff --git a/src/plugins/rssyl/opml_export.c b/src/plugins/rssyl/opml_export.c
index 7ec9369..bc165ee 100644
--- a/src/plugins/rssyl/opml_export.c
+++ b/src/plugins/rssyl/opml_export.c
@@ -125,8 +125,16 @@ void rssyl_opml_export(void)
 	opmlfile = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RSSYL_DIR,
 			G_DIR_SEPARATOR_S, RSSYL_OPML_FILE, NULL);
 
-	if( g_file_test(opmlfile, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR ) )
-		g_remove(opmlfile);
+	if( g_file_test(opmlfile, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR ) ) {
+		if (g_remove(opmlfile) != 0) {
+			log_warning(LOG_PROTOCOL,
+					_("RSSyl: Couldn't delete old OPML file '%s': %s\n"),
+					opmlfile, g_strerror(errno));
+			debug_print("RSSyl: couldn't delete old file '%s'\n", opmlfile);
+			g_free(opmlfile);
+			return;
+		}
+	}
 	
 	if( (f = g_fopen(opmlfile, "w")) == NULL ) {
 		log_warning(LOG_PROTOCOL,
diff --git a/src/plugins/rssyl/opml_import.c b/src/plugins/rssyl/opml_import.c
index 2a34f5d..737dfbe 100644
--- a/src/plugins/rssyl/opml_import.c
+++ b/src/plugins/rssyl/opml_import.c
@@ -104,7 +104,12 @@ void rssyl_opml_import_func(gchar *title, gchar *url, gint depth, gpointer data)
 		new_item = rssyl_feed_subscribe_new((FolderItem *)ctx->current->data,
 				url, TRUE);
 		/* ...and rename it if needed */
-		if (new_item != NULL && strcmp(title, new_item->name))
-			folder_item_rename(new_item, title);
+		if (new_item != NULL && strcmp(title, new_item->name)) {
+			if (folder_item_rename(new_item, title) < 0) {
+				alertpanel_error(_("Error while subscribing feed\n"
+							"%s\n\nFolder name '%s' is not allowed."),
+						url, title);
+			}
+		}
 	}
 }
diff --git a/src/plugins/rssyl/rssyl.c b/src/plugins/rssyl/rssyl.c
index 2c5a634..c87fde9 100644
--- a/src/plugins/rssyl/rssyl.c
+++ b/src/plugins/rssyl/rssyl.c
@@ -641,7 +641,7 @@ static gint rssyl_get_num_list(Folder *folder, FolderItem *item,
 
 	closedir(dp);
 
-	debug_print("Rssyl: get_num_list: returning %d\n", nummsgs);
+	debug_print("RSSyl: get_num_list: returning %d\n", nummsgs);
 
 	return nummsgs;
 }
diff --git a/src/plugins/rssyl/rssyl_add_item.c b/src/plugins/rssyl/rssyl_add_item.c
index 50a5102..1dc3e78 100644
--- a/src/plugins/rssyl/rssyl_add_item.c
+++ b/src/plugins/rssyl/rssyl_add_item.c
@@ -130,14 +130,14 @@ static gint rssyl_cb_feed_compare(const FeedItem *a, const FeedItem *b)
 			return 0;
 		else
 			return 1;
+	}
 
-		/* ... and as a last resort, if there is no title, item texts. */
-		if( no_title && a->text && b->text ) {
-			if( !strcmp(a->text, b->text) )
-				return 0;
-			else
-				return 1;
-		}
+	/* ... and as a last resort, if there is no title, item texts. */
+	if( no_title && a->text && b->text ) {
+		if( !strcmp(a->text, b->text) )
+			return 0;
+		else
+			return 1;
 	}
 
 	/* We don't know this item. */
@@ -269,7 +269,7 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
 	MsgPermFlags oldperm_flags = 0;
 	MsgInfo *msginfo;
 	FILE *f;
-	gint fd, d, dif;
+	gint fd, d, dif, errno = 0;
 	time_t tmpd;
 	gchar *meta_charset = NULL;
 	gchar *baseurl = NULL;
@@ -349,7 +349,10 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
 		oldperm_flags = msginfo->flags.perm_flags;
 
 		ritem->items = g_slist_remove(ritem->items, old_item);
-		g_remove(ctx->path);
+		if (g_unlink(ctx->path) != 0) {
+			debug_print("RSSyl: Error, could not delete file '%s': %s\n",
+					ctx->path, g_strerror(errno));
+		}
 
 		g_free(ctx->path);
 		feed_item_free(old_item);
diff --git a/src/plugins/rssyl/rssyl_deleted.c b/src/plugins/rssyl/rssyl_deleted.c
index d77c0b0..01cb0da 100644
--- a/src/plugins/rssyl/rssyl_deleted.c
+++ b/src/plugins/rssyl/rssyl_deleted.c
@@ -170,20 +170,25 @@ static void rssyl_deleted_store_internal(GSList *deleted_items, const gchar *del
 {
 	FILE *f;
 
-	if (g_file_test(deleted_file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
-		g_remove(deleted_file);
+	if (g_file_test(deleted_file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+		if (g_remove(deleted_file) != 0) {
+			debug_print("RSSyl: Oops, couldn't delete '%s', bailing out\n",
+					deleted_file);
+			return;
+		}
+	}
 
 	if (g_slist_length(deleted_items) == 0)
 		return;
 
 	if ((f = g_fopen(deleted_file, "w")) == NULL) {
-		debug_print("RSSyl: Couldn't open '%s', ignoring.\n", deleted_file);
+		debug_print("RSSyl: Couldn't open '%s', bailing out.\n", deleted_file);
 		return;
 	}
 
 	g_slist_foreach(deleted_items, (GFunc)_store_one_deleted_item,
 			(gpointer)f);
-	
+
 	fclose(f);
 	debug_print("RSSyl: written and closed deletion file\n");
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list