Mercurial > pidgin
comparison src/util.c @ 7614:48d7eea88598
[gaim-migrate @ 8238]
Hopefully this will fix the permissions errors some people are getting
on mkdir(). I have _no_ idea why it's happening, so I don't know if
this will work ... if anyone does know, please do tell.
Also fix a one-off in the pathname creation which was causing '/' to be
inserted twice at the root.
committer: Tailor Script <tailor@pidgin.im>
| author | Ethan Blanton <elb@pidgin.im> |
|---|---|
| date | Sun, 23 Nov 2003 21:03:28 +0000 |
| parents | 3ae88e96dde2 |
| children | a83aaf250284 |
comparison
equal
deleted
inserted
replaced
| 7613:62d11301b8a6 | 7614:48d7eea88598 |
|---|---|
| 1195 | 1195 |
| 1196 if (path == NULL || path[0] != G_DIR_SEPARATOR) | 1196 if (path == NULL || path[0] != G_DIR_SEPARATOR) |
| 1197 return -1; | 1197 return -1; |
| 1198 | 1198 |
| 1199 dir = g_new0(char, strlen(path) + 1); | 1199 dir = g_new0(char, strlen(path) + 1); |
| 1200 components = g_strsplit(path, delim, -1); | 1200 components = g_strsplit(path + 1, delim, -1); |
| 1201 len = 0; | 1201 len = 0; |
| 1202 for (cur = 0; components[cur] != NULL; cur++) { | 1202 for (cur = 0; components[cur] != NULL; cur++) { |
| 1203 dir[len++] = G_DIR_SEPARATOR; | 1203 dir[len++] = G_DIR_SEPARATOR; |
| 1204 strcpy(dir + len, components[cur]); | 1204 strcpy(dir + len, components[cur]); |
| 1205 len += strlen(components[cur]); | 1205 len += strlen(components[cur]); |
| 1223 gaim_debug(GAIM_DEBUG_WARNING, "build_dir", "mkdir: %s\n", strerror(errno)); | 1223 gaim_debug(GAIM_DEBUG_WARNING, "build_dir", "mkdir: %s\n", strerror(errno)); |
| 1224 g_strfreev(components); | 1224 g_strfreev(components); |
| 1225 g_free(dir); | 1225 g_free(dir); |
| 1226 return -1; | 1226 return -1; |
| 1227 } | 1227 } |
| 1228 /* For some reason, the above mkdir doesn't properly | |
| 1229 * set permissions for some people ... and I have NO | |
| 1230 * idea why not. In the meantime, we'll attempt to | |
| 1231 * set them explicitly. */ | |
| 1232 chmod(dir, mode); | |
| 1228 } | 1233 } |
| 1229 | 1234 |
| 1230 g_strfreev(components); | 1235 g_strfreev(components); |
| 1231 g_free(dir); | 1236 g_free(dir); |
| 1232 return 0; | 1237 return 0; |
