[telepathy-gabble/master] gabble_ft_manager_handle_si_request: check if strptime failed

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Apr 3 09:26:12 PDT 2009


---
 src/ft-manager.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/ft-manager.c b/src/ft-manager.c
index 1e0bc70..0f64861 100644
--- a/src/ft-manager.c
+++ b/src/ft-manager.c
@@ -432,7 +432,7 @@ void gabble_ft_manager_handle_si_request (GabbleFtManager *self,
   const gchar *filename, *size_str, *content_type, *content_hash, *description;
   const gchar *date_str;
   guint64 size;
-  guint64 date;
+  guint64 date = 0;
   TpFileHashType content_hash_type;
   GabbleFileTransferChannel *chan;
   gchar *path;
@@ -496,12 +496,8 @@ void gabble_ft_manager_handle_si_request (GabbleFtManager *self,
       struct tm tm;
 
       /* FIXME: this assume the timezone is always UTC */
-      strptime (date_str, "%FT%H:%M:%SZ", &tm);
-      date = (guint64) mktime (&tm);
-    }
-  else
-    {
-      date = 0;
+      if (strptime (date_str, "%FT%H:%M:%SZ", &tm) != NULL)
+        date = (guint64) mktime (&tm);
     }
 
   path = generate_object_path (self, handle);
-- 
1.5.6.5




More information about the telepathy-commits mailing list