commit - 5e5da8c4bcc83f7737a115b8da52fc3935fe3a6b
commit + c10270f60d5b5c805167e48e6a4fe265bdbecc69
blob - 1220c48e7f2ace97395c12e5a3af43b9c0bdc410
blob + 6c0be0af379525b0196b72464d3a886e439077d7
--- lib/dial.c
+++ lib/dial.c
#include <sys/socket.h>
#include <netdb.h>
+#include <assert.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include "got_path.h"
#include "got_lib_dial.h"
+
+#ifndef nitems
+#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
+#endif
#ifndef ssizeof
#define ssizeof(_x) ((ssize_t)(sizeof(_x)))
argv[i++] = (char *)cmd;
argv[i++] = (char *)path;
argv[i++] = NULL;
+ assert(i <= nitems(argv));
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pfd) == -1)
return got_error_from_errno("socketpair");