#include <errno.h>
]],
[[
+ size_t slen;
int listen_fd;
struct sockaddr_un addr;
memset (&addr, '\0', sizeof (addr));
addr.sun_family = AF_UNIX;
strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
+ /* SUN_LEN uses strlen() so need to calculate it before adding \0 at the
+ * beginning.
+ */
+ slen = SUN_LEN(&addr);
addr.sun_path[0] = '\0'; /* this is what makes it abstract */
- if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
+ if (bind (listen_fd, (struct sockaddr*) &addr, slen) < 0)
{
fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
strerror (errno));