2007-01-21 [colin] 2.7.1cvs44
[claws.git] / src / common / utils.c
index 4a656ddb04528e8b824adc7333a0885fe00d6d19..c1d1d84c15c4cc67c3358f771905e2c5254b8cbd 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto & The Claws Mail Team
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto & The Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -3294,7 +3294,7 @@ gchar *file_read_stream_to_str(FILE *fp)
        return str;
 }
 
-gint execute_async(gchar *const argv[])
+static gint execute_async(gchar *const argv[])
 {
        g_return_val_if_fail(argv != NULL && argv[0] != NULL, -1);
 
@@ -3307,7 +3307,7 @@ gint execute_async(gchar *const argv[])
        return 0;
 }
 
-gint execute_sync(gchar *const argv[])
+static gint execute_sync(gchar *const argv[])
 {
        gint status;
 
@@ -3378,7 +3378,7 @@ static gint is_unchanged_uri_char(char c)
        }
 }
 
-void encode_uri(gchar *encoded_uri, gint bufsize, const gchar *uri)
+static void encode_uri(gchar *encoded_uri, gint bufsize, const gchar *uri)
 {
        int i;
        int k;
@@ -4710,8 +4710,10 @@ gint copy_dir(const gchar *src, const gchar *dst)
                debug_print("copying: %s -> %s\n", old_file, new_file);
                if (g_file_test(old_file, G_FILE_TEST_IS_REGULAR)) {
                        gint r = copy_file(old_file, new_file, TRUE);
-                       if (r < 0)
+                       if (r < 0) {
+                               g_dir_close(dir);
                                return r;
+                       }
                } else if (g_file_test(old_file, G_FILE_TEST_IS_SYMLINK)) {
                        GError *error;
                        gint r = 0;
@@ -4719,14 +4721,19 @@ gint copy_dir(const gchar *src, const gchar *dst)
                        if (target)
                                r = symlink(target, new_file);
                        g_free(target);
-                       if (r < 0)
+                       if (r < 0) {
+                               g_dir_close(dir);
                                return r;
+                       }
                } else if (g_file_test(old_file, G_FILE_TEST_IS_DIR)) {
                        gint r = copy_dir(old_file, new_file);
-                       if (r < 0)
+                       if (r < 0) {
+                               g_dir_close(dir);
                                return r;
+                       }
                }
        }
+       g_dir_close(dir);
        return 0;
 }