* candidate fix for the MacOS wordexp issue
This commit is contained in:
@ -45,14 +45,23 @@ mu_util_dir_expand (const char *path)
|
|||||||
|
|
||||||
rv = wordexp (path, &wexp, 0);
|
rv = wordexp (path, &wexp, 0);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
g_warning ("%s: expansion failed for '%s' [%d]",
|
g_debug ("%s: expansion failed for '%s' [%d]",
|
||||||
__FUNCTION__, path, rv);
|
__FUNCTION__, path, rv);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else
|
} else if (wexp.we_wordc != 1) {
|
||||||
|
g_debug ("%s: expansion ambiguous for '%s'",
|
||||||
|
__FUNCTION__, path);
|
||||||
|
} else
|
||||||
dir = g_strdup (wexp.we_wordv[0]);
|
dir = g_strdup (wexp.we_wordv[0]);
|
||||||
|
|
||||||
wordfree (&wexp);
|
|
||||||
|
|
||||||
|
/* strangely, below seems to load to a crash on MacOS (BSD);
|
||||||
|
so we have to allow for a tiny leak here on that
|
||||||
|
platform... maybe instead of __APPLE__ it should be
|
||||||
|
__BSD__?*/
|
||||||
|
#ifndef __APPLE__
|
||||||
|
wordfree (&wexp);
|
||||||
|
#endif /*__APPLE__*/
|
||||||
|
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,14 +78,12 @@ mu_util_check_dir (const gchar* path, gboolean readable, gboolean writeable)
|
|||||||
mode = F_OK | (readable ? R_OK : 0) | (writeable ? W_OK : 0);
|
mode = F_OK | (readable ? R_OK : 0) | (writeable ? W_OK : 0);
|
||||||
|
|
||||||
if (access (path, mode) != 0) {
|
if (access (path, mode) != 0) {
|
||||||
MU_WRITE_LOG ("Cannot access %s: %s", path,
|
g_debug ("Cannot access %s: %s", path, strerror (errno));
|
||||||
strerror (errno));
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat (path, &statbuf) != 0) {
|
if (stat (path, &statbuf) != 0) {
|
||||||
MU_WRITE_LOG ("Cannot stat %s: %s", path,
|
g_debug ("Cannot stat %s: %s", path, strerror (errno));
|
||||||
strerror (errno));
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user