* fix error handling of shell expansion (candidate fix for issue #23)
This commit is contained in:
@ -78,9 +78,9 @@ check_index_params (MuConfigOptions *opts)
|
|||||||
g_warning ("Error: Invalid option(s) for command\n");
|
g_warning ("Error: Invalid option(s) for command\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_path_is_absolute (opts->maildir)) {
|
if (!opts->maildir || !g_path_is_absolute (opts->maildir)) {
|
||||||
g_warning ("Error: maildir path must be absolute\n");
|
g_warning ("Error: maildir path is not valid\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,14 +37,18 @@ mu_util_dir_expand (const char *path)
|
|||||||
{
|
{
|
||||||
wordexp_t wexp;
|
wordexp_t wexp;
|
||||||
char *dir;
|
char *dir;
|
||||||
|
int rv;
|
||||||
|
|
||||||
g_return_val_if_fail (path, NULL);
|
g_return_val_if_fail (path, NULL);
|
||||||
|
|
||||||
dir = NULL;
|
dir = NULL;
|
||||||
wordexp (path, &wexp, 0);
|
|
||||||
if (wexp.we_wordc != 1)
|
rv = wordexp (path, &wexp, 0);
|
||||||
g_warning ("error expanding dir '%s'", path);
|
if (rv != 0) {
|
||||||
else
|
g_warning ("%s: expansion failed for '%s' [%d]",
|
||||||
|
__FUNCTION__, path, rv);
|
||||||
|
return NULL;
|
||||||
|
} else
|
||||||
dir = g_strdup (wexp.we_wordv[0]);
|
dir = g_strdup (wexp.we_wordv[0]);
|
||||||
|
|
||||||
wordfree (&wexp);
|
wordfree (&wexp);
|
||||||
@ -52,6 +56,7 @@ mu_util_dir_expand (const char *path)
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
mu_util_check_dir (const gchar* path, gboolean readable, gboolean writeable)
|
mu_util_check_dir (const gchar* path, gboolean readable, gboolean writeable)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user