summaryrefslogtreecommitdiff
path: root/devel/libgnome/patches/patch-ac
blob: 3c72615484607a4337e5656a14e965dfef7f836e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
$NetBSD: patch-ac,v 1.4 2004/04/01 18:22:04 jmmv Exp $

http://bugzilla.gnome.org/show_bug.cgi?id=106117

--- libgnome/gnome-init.c.orig	2004-03-16 11:44:07.000000000 +0100
+++ libgnome/gnome-init.c
@@ -53,6 +53,8 @@
 
 #include <libgnomevfs/gnome-vfs-init.h>
 
+int libgnome_mkdir(const char *path, mode_t mode);
+
 /*****************************************************************************
  * bonobo
  *****************************************************************************/
@@ -299,7 +301,7 @@ libgnome_userdir_setup (gboolean create_
 	if (!create_dirs)
 		return;
 	
-	if (mkdir (gnome_user_dir, 0700) < 0) { /* private permissions, but we
+	if (libgnome_mkdir (gnome_user_dir, 0700) < 0) { /* private permissions, but we
 						   don't check that we got them */
 		if (errno != EEXIST) {
 			g_printerr (_("Could not create per-user gnome configuration directory `%s': %s\n"),
@@ -308,7 +310,7 @@ libgnome_userdir_setup (gboolean create_
 		}
 	}
     
-	if (mkdir (gnome_user_private_dir, 0700) < 0) { /* This is private
+	if (libgnome_mkdir (gnome_user_private_dir, 0700) < 0) { /* This is private
 							   per-user info mode
 							   700 will be
 							   enforced!  maybe
@@ -330,7 +332,7 @@ libgnome_userdir_setup (gboolean create_
 		exit(1);
 	}
   
-	if (mkdir (gnome_user_accels_dir, 0700) < 0) {
+	if (libgnome_mkdir (gnome_user_accels_dir, 0700) < 0) {
 		if (errno != EEXIST) {
 			g_printerr (_("Could not create gnome accelerators directory `%s': %s\n"),
 				gnome_user_accels_dir, strerror(errno));
@@ -461,3 +463,24 @@ libgnome_module_info_get (void)
 
 	return &module_info;
 }
+
+int
+libgnome_mkdir(const char *path, mode_t mode)
+{
+	char *tmp;
+	size_t length;
+	int ret;
+
+	length = strlen(path);
+	tmp = (char *) malloc(length + 1);
+	strcpy(tmp, path);
+	length--;
+	while (tmp[length] == '/' && length > 0) {
+		tmp[length] = '\0';
+		length--;
+	}
+	ret = mkdir(tmp, mode);
+
+	free(tmp);
+	return ret;
+}