chiark / gitweb /
Brown-paper-bag fixes.
[mLib] / fdpass.c
index 0a11c2cbea87b7796b7069339a2150061625fd98..8a33c2b366a8a3ab276b4372ddde6715a9a7840a 100644 (file)
--- a/fdpass.c
+++ b/fdpass.c
@@ -7,7 +7,7 @@
  * (c) 2003 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of the mLib utilities library.
  *
  * it under the terms of the GNU Library General Public License as
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
- * 
+ *
  * mLib is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Library General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Library General Public
  * License along with mLib; if not, write to the Free
  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@ -29,6 +29,8 @@
 
 /*----- Header files ------------------------------------------------------*/
 
+#include "config.h"
+
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -77,7 +79,7 @@ ssize_t fdpass_send(int sock, int fd, const void *p, size_t sz)
 #ifdef HAVE_MSG_ACCRIGHTS
   msg.msg_accrights = &fd;
   msg.msg_accrightslen = sizeof(fd);
-#else  
+#else
   msg.msg_flags = 0;
   msg.msg_control = buf;
   msg.msg_controllen = sizeof(buf);
@@ -139,7 +141,7 @@ ssize_t fdpass_recv(int sock, int *fd, void *p, size_t sz)
   for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
     if (cmsg->cmsg_level == SOL_SOCKET &&
        cmsg->cmsg_type == SCM_RIGHTS &&
-        cmsg->cmsg_len >= CMSG_LEN(sizeof(fd))) {
+       cmsg->cmsg_len >= CMSG_LEN(sizeof(fd))) {
       memcpy(&fdtmp, CMSG_DATA(cmsg), sizeof(fdtmp));
       if (*fd == -1)
        *fd = fdtmp;