[Commits] utils.c 1.36.2.211 1.36.2.212

colin at claws-mail.org colin at claws-mail.org
Mon Dec 3 10:34:17 CET 2012


Update of /home/claws-mail/claws/src/common
In directory srv:/tmp/cvs-serv18387/src/common

Modified Files:
      Tag: gtk2
	utils.c 
Log Message:
2012-12-03 [colin]	3.9.0cvs38

	* src/common/utils.c
		Fix following relative symlinks

Index: utils.c
===================================================================
RCS file: /home/claws-mail/claws/src/common/utils.c,v
retrieving revision 1.36.2.211
retrieving revision 1.36.2.212
diff -u -d -r1.36.2.211 -r1.36.2.212
--- utils.c	1 Dec 2012 21:23:10 -0000	1.36.2.211
+++ utils.c	3 Dec 2012 09:34:15 -0000	1.36.2.212
@@ -1865,10 +1865,11 @@
 const gchar *get_rc_dir(void)
 {
 
-	if (!claws_rc_dir)
+	if (!claws_rc_dir) {
 		claws_rc_dir = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
 				     RC_DIR, NULL);
-
+		debug_print("using default rc_dir %s\n", claws_rc_dir);
+	}
 	return claws_rc_dir;
 }
 
@@ -1879,6 +1880,8 @@
 		g_print("Error: rc_dir already set\n");
 	} else {
 		int err = cm_canonicalize_filename(dir, &canonical_dir);
+		int len;
+
 		if (err) {
 			g_print("Error looking for %s: %d(%s)\n",
 				dir, -err, strerror(-err));
@@ -1888,6 +1891,10 @@
 
 		claws_rc_dir = canonical_dir;
 		
+		len = strlen(claws_rc_dir);
+		if (claws_rc_dir[len - 1] == G_DIR_SEPARATOR)
+			claws_rc_dir[len - 1] = '\0';
+		
 		debug_print("set rc_dir to %s\n", claws_rc_dir);
 		if (!is_dir_exist(claws_rc_dir)) {
 			if (make_dir_hier(claws_rc_dir) != 0) {
@@ -5450,6 +5457,21 @@
 				GError *error = NULL;
 				gchar *target = g_file_read_link(tmp_path, &error);
 
+				if (!g_path_is_absolute(target)) {
+					/* remove the last inserted element */
+					canonical_parts = 
+						g_slist_delete_link(canonical_parts,
+							    canonical_parts);
+					/* add the target */
+					canonical_parts = g_slist_prepend(canonical_parts,
+						g_strdup(target));
+					g_free(target);
+
+					/* and get the new target */
+					target = canonical_list_to_file(canonical_parts);
+				}
+
+				/* restart from absolute target */
 				slist_free_strings_full(canonical_parts);
 				canonical_parts = NULL;
 				if (!error)



More information about the Commits mailing list