Close the file descriptor. (#75507, Matthias Clasen)

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)
This commit is contained in:
Owen Taylor
2002-03-20 16:21:58 +00:00
committed by Owen Taylor
parent a841dbd7a2
commit eccf6b573b
8 changed files with 45 additions and 2 deletions

View 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