--- euses-2.5.2/euses.c 2006-11-24 19:18:07.000000000 +0100 +++ work/euses.c 2006-11-24 19:21:28.000000000 +0100 @@ -128,10 +128,13 @@ FILE *fd; /* Check if PORTDIR is set in the environment */ - snprintf(portdir, FILENAME_MAX, "%s", getenv("PORTDIR")); + char *envportdir = getenv("PORTDIR"); + if (envportdir != NULL) { + snprintf(portdir, FILENAME_MAX, "%s", envportdir); + } /* or load it from make.{globals,conf} */ - if (strlen(portdir) == 0) { + else { /* Open a pipe to sh */ fd = popen("source " SYSCONFDIR "/make.globals;" "source " SYSCONFDIR "/make.conf" ";" "echo -n ${PORTDIR}",