Close the file descriptor. (#75507, Matthias Clasen)
authorOwen Taylor <otaylor@redhat.com>
Wed, 20 Mar 2002 16:21:58 +0000 (16:21 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Wed, 20 Mar 2002 16:21:58 +0000 (16:21 +0000)
Wed Mar 20 11:17:32 2002  Owen Taylor  <otaylor@redhat.com>

        * glib/gfileutils.c (get_contents_regfile): Close the
        file descriptor. (#75507, Matthias Clasen)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gfileutils.c

index be2111a..01307bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Mar 20 11:17:32 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gfileutils.c (get_contents_regfile): Close the
+       file descriptor. (#75507, Matthias Clasen)
+
 Wed Mar 20 11:00:59 2002  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Use $PKG_CONFIG, not pkg-config.
index be2111a..01307bc 100644 (file)
@@ -1,3 +1,8 @@
+Wed Mar 20 11:17:32 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gfileutils.c (get_contents_regfile): Close the
+       file descriptor. (#75507, Matthias Clasen)
+
 Wed Mar 20 11:00:59 2002  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Use $PKG_CONFIG, not pkg-config.
index be2111a..01307bc 100644 (file)
@@ -1,3 +1,8 @@
+Wed Mar 20 11:17:32 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gfileutils.c (get_contents_regfile): Close the
+       file descriptor. (#75507, Matthias Clasen)
+
 Wed Mar 20 11:00:59 2002  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Use $PKG_CONFIG, not pkg-config.
index be2111a..01307bc 100644 (file)
@@ -1,3 +1,8 @@
+Wed Mar 20 11:17:32 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gfileutils.c (get_contents_regfile): Close the
+       file descriptor. (#75507, Matthias Clasen)
+
 Wed Mar 20 11:00:59 2002  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Use $PKG_CONFIG, not pkg-config.
index be2111a..01307bc 100644 (file)
@@ -1,3 +1,8 @@
+Wed Mar 20 11:17:32 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gfileutils.c (get_contents_regfile): Close the
+       file descriptor. (#75507, Matthias Clasen)
+
 Wed Mar 20 11:00:59 2002  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Use $PKG_CONFIG, not pkg-config.
index be2111a..01307bc 100644 (file)
@@ -1,3 +1,8 @@
+Wed Mar 20 11:17:32 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gfileutils.c (get_contents_regfile): Close the
+       file descriptor. (#75507, Matthias Clasen)
+
 Wed Mar 20 11:00:59 2002  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Use $PKG_CONFIG, not pkg-config.
index be2111a..01307bc 100644 (file)
@@ -1,3 +1,8 @@
+Wed Mar 20 11:17:32 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * glib/gfileutils.c (get_contents_regfile): Close the
+       file descriptor. (#75507, Matthias Clasen)
+
 Wed Mar 20 11:00:59 2002  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Use $PKG_CONFIG, not pkg-config.
index fbe8bd7..feeba79 100644 (file)
@@ -402,7 +402,7 @@ get_contents_regfile (const gchar *filename,
                    _("Could not allocate %lu bytes to read file \"%s\""),
                    (gulong) alloc_size, filename);
 
-      return FALSE;
+      goto error;
     }
   
   bytes_read = 0;
@@ -426,7 +426,7 @@ get_contents_regfile (const gchar *filename,
                            _("Failed to read from file '%s': %s"),
                            filename, g_strerror (errno));
 
-              return FALSE;
+             goto error;
             }
         }
       else if (rc == 0)
@@ -442,7 +442,15 @@ get_contents_regfile (const gchar *filename,
   
   *contents = buf;
 
+  close (fd);
+
   return TRUE;
+
+ error:
+
+  close (fd);
+  
+  return FALSE;
 }
 
 static gboolean