From: Nikolas Garofil Date: Mon, 16 Nov 2009 19:19:57 +0000 (+0100) Subject: Bugfix: crash when apcupsd isnt running X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=90f5701f3e25c6954e730fc5f9763f9f44f2d8a2;p=monky Bugfix: crash when apcupsd isnt running --- diff --git a/src/apcupsd.c b/src/apcupsd.c index d6b6e76..7bec156 100644 --- a/src/apcupsd.c +++ b/src/apcupsd.c @@ -181,7 +181,7 @@ void update_apcupsd(void) { break; } #ifdef HAVE_GETHOSTBYNAME_R - if (gethostbyname_r(info.apcupsd.host, &he_mem, hostbuff, sizeof(hostbuff), &he, &he_errno)) { + if (gethostbyname_r(info.apcupsd.host, &he_mem, hostbuff, sizeof(hostbuff), &he, &he_errno) || !he ) { NORM_ERR("APCUPSD gethostbyname_r: %s", hstrerror(h_errno)); break; }