From 995f6539fb26444a0496b6311fecdbe9ad9cc8ff Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 28 May 2005 21:04:49 +0000 Subject: Check return value of fgets. 2005-05-28 Christian Persch * src/bookmarks/ephy-bookmarks-import.c: (gul_general_read_line_from_file): Check return value of fgets. --- ChangeLog | 7 +++++++ src/bookmarks/ephy-bookmarks-import.c | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8aacf19ab..4a471bf52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-05-28 Christian Persch + + * src/bookmarks/ephy-bookmarks-import.c: + (gul_general_read_line_from_file): + + Check return value of fgets. + 2005-05-28 Christian Persch * doc/reference/Makefile.am: diff --git a/src/bookmarks/ephy-bookmarks-import.c b/src/bookmarks/ephy-bookmarks-import.c index 47cf97f34..e56442437 100644 --- a/src/bookmarks/ephy-bookmarks-import.c +++ b/src/bookmarks/ephy-bookmarks-import.c @@ -488,10 +488,12 @@ gul_general_read_line_from_file (FILE *f) gchar *t; gchar *buf = g_new0 (gchar, 256); while ( ! ( strchr (buf, '\n') || feof (f) ) ) { - fgets(buf, 256, f); - t = line; - line = g_strconcat (line, buf, NULL); - g_free (t); + if (fgets(buf, 256, f)) + { + t = line; + line = g_strconcat (line, buf, NULL); + g_free (t); + } } g_free (buf); return line; -- cgit v1.2.3