time_t t, t2, offset = 0;
gboolean success = FALSE;
gchar *pos;
-
- g_assert(date != NULL);
+
+ if (date == NULL)
+ return -1;
memset(&tm, 0, sizeof(struct tm));
nitem->id_is_permalink = item->id_is_permalink;
nitem->xhtml_content = item->xhtml_content;
- nitem->data = g_memdup(item->data, sizeof(item->data));
+ /* We have no way of knowing the size of object item->data is pointing
+ * to, so we can not reliably copy it to the new item. Caller will have
+ * to take care of that itself. */
+ nitem->data = NULL;
return nitem;
}
} else if( ctx->depth == 2 ) {
+ /* This should only happen with malformed atom feeds - we're in
+ * XML depth 2, but not inside an <entry> block. */
+ if (ctx->curitem == NULL)
+ return;
+
if( !strcmp(el, "author") ) {
/* Start of author info for current feed item.
* Set correct location. */
dirname = folder_item_get_path(&ritem->item);
template = g_strconcat(dirname, G_DIR_SEPARATOR_S,
RSSYL_TMP_TEMPLATE, NULL);
- fd = mkstemp(template);
+ if ((fd = mkstemp(template)) < 0) {
+ g_warning("Couldn't mkstemp('%s'), not adding message!\n", template);
+ g_free(template);
+ return;
+ }
f = fdopen(fd, "w");
- if(f == NULL) {
- g_warning("Couldn't open file '%s', not adding msg!\n", template);
+ if (f == NULL) {
+ g_warning("Couldn't open file '%s', not adding message!\n", template);
g_free(template);
return;
}
closedir(dp);
g_free(path);
debug_print("RSSyl: bailing out, app is exiting\n");
+ return;
}
if( (num = to_number(d->d_name)) > 0 && d->d_type == DT_REG ) {
}
/* rssyl_fetch_feed() */
-RFetchCtx *rssyl_fetch_feed(RFetchCtx *ctx, gboolean verbose)
+void rssyl_fetch_feed(RFetchCtx *ctx, gboolean verbose)
{
#ifdef USE_PTHREAD
pthread_t pt;
ctx->success = FALSE;
} else {
- if( ctx->feed == NULL || feed_get_title(ctx->feed) == NULL ) {
+ if( feed_get_title(ctx->feed) == NULL ) {
/* libcurl was happy, but libfeed wasn't */
debug_print("RSSyl: Error reading feed\n");
if( verbose )
alertpanel_error(_("No valid feed found at\n<b>%s</b>"),
feed_get_url(ctx->feed));
- log_error(LOG_PROTOCOL, RSSYL_LOG_ERROR_NOFEED, ctx->feed->url);
+
+ log_error(LOG_PROTOCOL, RSSYL_LOG_ERROR_NOFEED,
+ feed_get_url(ctx->feed));
+
ctx->success = FALSE;
}
}