diff --git a/NEWS b/NEWS index a69679b..8979d37 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,9 @@ __ https://www.zap.org.au/ Version 7.17 (not yet released) ------------------------------- +Fixed a bug when the ``HOME`` environment variable is empty: use the +current directory instead. + Updated the Brazilian Portuguese, Norwegian Bokmål, Swedish, French, Esperanto, Serbian, German and English translations (in that order), with thanks to Rafael Fontenelle, Johnny A. Solbu, Anders Jonsson, Frédéric diff --git a/src/utils.c b/src/utils.c index a209b56..3a30080 100644 --- a/src/utils.c +++ b/src/utils.c @@ -56,6 +56,7 @@ wchar_t *mon_thousands_sep; // Locale's monetary thousands separator #define APPIMAGE_NAME "AppRun.wrapped" #define DIRSEP "/" // Directory separator +#define CURDIR "." // Current directory #define HIDDEN_PATH "." // Hidden file start char #define XDG_DATA_DEFAULT ".local" DIRSEP "share" @@ -314,7 +315,8 @@ static ssize_t b64decode (const void *restrict in, size_t inlen, * Initialisation and environment function definitions * ************************************************************************/ -// These functions are documented in the file "utils.h" +/* These functions are documented in the file "utils.h" or in the + comments above. */ /***********************************************************************/ @@ -361,6 +363,8 @@ const char *home_directory (void) if (home != NULL && *home != '\0') { home_directory_str = xstrdup(home); + } else { + home_directory_str = xstrdup(CURDIR); } }