tweaks: avoid passing NULL to access()

This prevents an unwanted message when nano
is compiled with -fsanitize=undefined.

This fixes https://savannah.gnu.org/bugs/?63447.

Problem existed since version 4.8, commit 343f97b3,
since the --rcfile option was added.
This commit is contained in:
Benno Schulenberg 2022-11-30 12:00:07 +01:00
parent 4f92b12a6a
commit 846588ee81

View File

@ -1707,7 +1707,7 @@ void do_rcfiles(void)
{
if (custom_nanorc) {
nanorc = get_full_path(custom_nanorc);
if (access(nanorc, F_OK) != 0)
if (nanorc == NULL || access(nanorc, F_OK) != 0)
die(_("Specified rcfile does not exist\n"));
} else
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");