$NetBSD: patch-ac,v 1.3 2003/02/15 13:30:50 jmmv Exp $ --- libgnome/gnome-init.c.orig 2002-11-22 14:47:27.000000000 +0100 +++ libgnome/gnome-init.c @@ -53,6 +53,8 @@ #include +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) { fprintf(stderr, _("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) { fprintf(stderr, _("Could not create gnome accelerators directory `%s': %s\n"), gnome_user_accels_dir, strerror(errno)); @@ -462,3 +464,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; +}