dtgreet: Do not crash if LANG is not set in the environment.

In that case, catopen() will have never been called, and we'd feed 0 as the
first argument to catgets().  This crashes, at least on OpenBSD.
This commit is contained in:
Pascal Stumpf 2012-11-20 19:42:33 +01:00 committed by Jon Trulson
parent 0e5560cee4
commit 76c874b068
1 changed files with 1 additions and 1 deletions

View File

@ -791,7 +791,7 @@ unsigned char *
ReadCatalog(int setn, int msgn, char *dflt)
{
OpenCatalog();
if (0 > (int) nl_fd)
if ((0 > (int) nl_fd) || (NULL == langenv))
return (unsigned char*) dflt;
else
return (unsigned char*) catgets(nl_fd, setn, msgn, dflt);