socket: fix proto not supported under FreeBSD (FS#349)

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Konstantin Stepanov 2008-11-03 14:53:23 +01:00 committed by Julien Danjou
parent 9ce1f986d9
commit d7e5a8f1a3
2 changed files with 8 additions and 1 deletions

View File

@ -92,7 +92,11 @@ sockets_reconnect(void)
static int static int
send_msg(const char *msg, ssize_t msg_len) send_msg(const char *msg, ssize_t msg_len)
{ {
#ifndef __FreeBSD__
if(send(csfd, msg, msg_len, MSG_NOSIGNAL | MSG_EOR) == -1) if(send(csfd, msg, msg_len, MSG_NOSIGNAL | MSG_EOR) == -1)
#else
if(send(csfd, msg, msg_len, MSG_NOSIGNAL | MSG_EOF) == -1)
#endif
{ {
switch (errno) switch (errno)
{ {

View File

@ -78,8 +78,11 @@ int
socket_getclient(void) socket_getclient(void)
{ {
int csfd; int csfd;
#ifndef __FreeBSD__
csfd = socket(AF_UNIX, SOCK_SEQPACKET, 0); csfd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
#else
csfd = socket(PF_UNIX, SOCK_STREAM, 0);
#endif
if(csfd < 0) if(csfd < 0)
warn("error opening UNIX domain socket: %s", strerror(errno)); warn("error opening UNIX domain socket: %s", strerror(errno));