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