commit 86fd3eca054ad3355074b36af86719159a1f005d
parent cb3a54ee753a224e23d5386b8639d26297de8fd0
Author: Kyle Milz <kyle@0x30.net>
Date: Wed, 13 Jul 2016 23:07:30 -0600
src: reorder includes and switch to c++ stdlib includes
Diffstat:
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/af_unix.cc b/src/af_unix.cc
@@ -1,15 +1,12 @@
-#if __gnu_linux__
-#include <bsd/string.h> // strlcpy
-#endif
-#include <err.h> // err
-#include <errno.h> // EWOULDBLOCK
-#include <fcntl.h>
-#include <string.h> // memset, strlcpy
-#include <sys/socket.h> // socket
+#include <sys/socket.h> // accept, socket
#include <sys/un.h> // sockaddr_un
-#include <unistd.h> // close
+#include <err.h> // err
+#include <cerrno> // EWOULDBLOCK
+#include <cstring> // memset, strcpy
+#include <fcntl.h> // fcntl, F_GETFL
#include <iostream>
+#include <unistd.h> // close
#include "af_unix.h"
@@ -41,14 +38,14 @@ af_unix::set_listen()
#endif
struct sockaddr_un addr;
- memset(&addr, 0, sizeof(addr));
+ std::memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
- strlcpy(addr.sun_path, "/tmp/citrun-gl.socket", sizeof(addr.sun_path));
+ std::strcpy(addr.sun_path, "/tmp/citrun-gl.socket");
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)))
err(1, "bind");
- /* Size 1024 backlog */
+ // Size 1024 backlog
if (listen(fd, 1024))
err(1, "listen");
}