chiark / gitweb /
Remove src/notify
[elogind.git] / src / nss-resolve / nss-resolve.c
index 39b73203d26afbc351f1e9d60c15233a595ada1f..bc6c5dc2a0f5c395c5a36f9d046a3d666eced3fe 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <limits.h>
 #include <nss.h>
-#include <sys/types.h>
 #include <netdb.h>
 #include <errno.h>
 #include <string.h>
-#include <unistd.h>
-#include <net/if.h>
 #include <stdlib.h>
-#include <arpa/inet.h>
 #include <dlfcn.h>
 
 #include "sd-bus.h"
 #include "bus-util.h"
-#include "bus-errors.h"
+#include "bus-common-errors.h"
 #include "macro.h"
 #include "nss-util.h"
 #include "util.h"
@@ -404,10 +399,7 @@ enum nss_status _nss_resolve_gethostbyname3_r(
         alen = FAMILY_ADDRESS_SIZE(af);
         l = strlen(canonical);
 
-        ms = ALIGN(l+1) +
-                sizeof(char*) +
-                (c > 0 ? c : 1) * ALIGN(alen) +
-                (c > 0 ? c+1 : 2) * sizeof(char*);
+        ms = ALIGN(l+1) + c * ALIGN(alen) + (c+2) * sizeof(char*);
 
         if (buflen < ms) {
                 *errnop = ENOMEM;