]> diplodocus.org Git - nmh/blobdiff - test/server.c
Support sending multiple commands at once.
[nmh] / test / server.c
index 5d207141176cc73732d77f86d283e71d9211cfeb..8d5e021390080c9d1ea2ebd75a2a7c134ea6ebc6 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * server.c - Utilities for fake servers used by the nmh test suite
+/* server.c - Utilities for fake servers used by the nmh test suite
  *
  * This code is Copyright (c) 2014, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
  *
  * This code is Copyright (c) 2014, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -25,6 +24,10 @@ static const char *PIDFN = NULL;
 static void killpidfile(void);
 static void handleterm(int);
 
 static void killpidfile(void);
 static void handleterm(int);
 
+#ifndef EPROTOTYPE
+#define EPROTOTYPE 0
+#endif
+
 static int
 try_bind(int socket, const struct sockaddr *address, socklen_t len)
 {
 static int
 try_bind(int socket, const struct sockaddr *address, socklen_t len)
 {
@@ -217,9 +220,11 @@ putcrlf(int socket, char *data)
        iov[1].iov_len = 2;
 
        /* ECONNRESET just means the client already closed its end */
        iov[1].iov_len = 2;
 
        /* ECONNRESET just means the client already closed its end */
+       /* MacOS X can also return EPROTOTYPE (!) here sometimes */
        /* XXX is it useful to log errors here at all? */
        /* XXX is it useful to log errors here at all? */
-       if (writev(socket, iov, 2) < 0 && errno != ECONNRESET) {
-           perror ("writev");
+       if (writev(socket, iov, 2) < 0 && errno != ECONNRESET &&
+           errno != EPROTOTYPE) {
+           perror ("server writev");
        }
 }
 
        }
 }