int fd;
ssize_t len;
const uschar * where;
+#ifndef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS
+uschar * sname;
+#endif
if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
{
return NULL;
}
-#define ABSTRACT_CLIENT
-#ifdef ABSTRACT_CLIENT
+#ifdef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS
sun.sun_path[0] = 0; /* Abstract local socket addr - Linux-specific? */
len = offsetof(struct sockaddr_un, sun_path) + 1
+ snprintf(sun.sun_path+1, sizeof(sun.sun_path)-1, "exim_%d", getpid());
#else
+sname = string_sprintf("%s/p_%d", spool_directory, getpid());
len = offsetof(struct sockaddr_un, sun_path)
- + snprintf(sun.sun_path, sizeof(sun.sun_path), "%s/p_%d",
- spool_directory, getpid());
+ + snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", sname);
#endif
if (bind(fd, (const struct sockaddr *)&sun, len) < 0)
{ where = US"bind"; goto bad; }
#ifdef notdef
-debug_printf("local%s '%s'\n", *sun.sun_path ? "" : " abstract",
- sun.sun_path+ (*sun.sun_path ? 0 : 1));
+debug_printf("local addr '%s%s'\n",
+ *sun.sun_path ? "" : "@",
+ sun.sun_path + (*sun.sun_path ? 0 : 1));
#endif
+#ifdef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS
sun.sun_path[0] = 0; /* Abstract local socket addr - Linux-specific? */
len = offsetof(struct sockaddr_un, sun_path) + 1
+ snprintf(sun.sun_path+1, sizeof(sun.sun_path)-1, "%s", NOTIFIER_SOCKET_NAME);
+#else
+len = offsetof(struct sockaddr_un, sun_path)
+ + snprintf(sun.sun_path, sizeof(sun.sun_path), "%s/%s",
+ spool_directory, NOTIFIER_SOCKET_NAME);
+#endif
if (connect(fd, (const struct sockaddr *)&sun, len) < 0)
{ where = US"connect"; goto bad; }
if ((len = recv(fd, buf, sizeof(buf), 0)) < 0) { where = US"recv"; goto bad; }
close(fd);
+#ifndef EXIM_HAVE_ABSTRACT_UNIX_SOCKETS
+Uunlink(sname);
+#endif
return string_copyn(buf, len);
bad: