(read_rc, mu_create_argcv): Do not bail out if mu_tilde_expansion() returns NUL…
…L. There may be users without homedir.
Showing
1 changed file
with
5 additions
and
12 deletions
... | @@ -572,11 +572,8 @@ read_rc (const char *progname, const char *name, const char *capa[], | ... | @@ -572,11 +572,8 @@ read_rc (const char *progname, const char *name, const char *capa[], |
572 | char* rcfile = mu_tilde_expansion (name, "/", NULL); | 572 | char* rcfile = mu_tilde_expansion (name, "/", NULL); |
573 | 573 | ||
574 | if (!rcfile) | 574 | if (!rcfile) |
575 | { | 575 | return; |
576 | fprintf (stderr, _("%s: not enough memory\n"), progname); | 576 | |
577 | exit (1); | ||
578 | } | ||
579 | |||
580 | fp = fopen (rcfile, "r"); | 577 | fp = fopen (rcfile, "r"); |
581 | if (!fp) | 578 | if (!fp) |
582 | { | 579 | { |
... | @@ -717,19 +714,15 @@ mu_create_argcv (const char *capa[], | ... | @@ -717,19 +714,15 @@ mu_create_argcv (const char *capa[], |
717 | struct stat s; | 714 | struct stat s; |
718 | char* rcdirname = mu_tilde_expansion (MU_USER_CONFIG_FILE, "/", NULL); | 715 | char* rcdirname = mu_tilde_expansion (MU_USER_CONFIG_FILE, "/", NULL); |
719 | 716 | ||
720 | if (!rcdirname) | 717 | if (!rcdirname |
721 | { | 718 | || (stat(rcdirname, &s) == 0 && S_ISDIR(s.st_mode))) |
722 | fprintf (stderr, _("%s: not enough memory\n"), progname); | ||
723 | exit (1); | ||
724 | } | ||
725 | if(stat(rcdirname, &s) == 0 && S_ISDIR(s.st_mode)) | ||
726 | rcdir = 1; | 719 | rcdir = 1; |
727 | 720 | ||
728 | free(rcdirname); | 721 | free(rcdirname); |
729 | } | 722 | } |
730 | 723 | ||
731 | /* Add per-user config file. */ | 724 | /* Add per-user config file. */ |
732 | if(!rcdir) | 725 | if (!rcdir) |
733 | { | 726 | { |
734 | read_rc (progname, MU_USER_CONFIG_FILE, capa, &x_argc, &x_argv); | 727 | read_rc (progname, MU_USER_CONFIG_FILE, capa, &x_argc, &x_argv); |
735 | } | 728 | } | ... | ... |
-
Please register or sign in to post a comment