gsettingsschema: Close directory
[platform/upstream/glib.git] / gio / gresource-tool.c
index b38e407..634a83a 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Matthias Clasen
  */
 #include <glib/gstdio.h>
 #include <gi18n.h>
 
+#ifdef G_OS_WIN32
+#include "glib/glib-private.h"
+#endif
+
 /* GResource functions {{{1 */
 static GResource *
 get_resource (const gchar *file)
@@ -149,10 +151,18 @@ get_elf (const gchar *file,
 
   elf = elf_begin (*fd, ELF_C_READ, NULL);
   if (elf == NULL)
-    return NULL;
+    {
+      g_close (*fd, NULL);
+      *fd = -1;
+      return NULL;
+    }
 
   if (elf_kind (elf) != ELF_K_ELF)
-    return NULL;
+    {
+      g_close (*fd, NULL);
+      *fd = -1;
+      return NULL;
+    }
 
   return elf;
 }
@@ -583,7 +593,6 @@ main (int argc, char *argv[])
   void (* function) (const gchar *, const gchar *, const gchar *, gboolean);
 
 #ifdef G_OS_WIN32
-  extern gchar *_glib_get_locale_dir (void);
   gchar *tmp;
 #endif