summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph <ra@apathie.net>2015-03-19 08:36:27 +0800
committerEmil Renner Berthing <esmil@mailme.dk>2016-01-08 00:20:12 +0100
commit9f5ebd9bf3baab867391f2a4803bea0c2b22c2d9 (patch)
treebe039aa3c420e42f498e36b1f4b91c3b75329060
parentc5dffb868f3f05943f2328243b797b3c93d018c3 (diff)
downloadlem-9f5ebd9bf3baab867391f2a4803bea0c2b22c2d9.tar.gz
lem-9f5ebd9bf3baab867391f2a4803bea0c2b22c2d9.tar.xz
lem-9f5ebd9bf3baab867391f2a4803bea0c2b22c2d9.zip
io: fix Linux include and UNIX_PATH_MAX fallback
This makes it easier to compile against other C libraries than glibc.
-rw-r--r--lem/io/core.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lem/io/core.c b/lem/io/core.c
index 9c8dfc2..1ec3843 100644
--- a/lem/io/core.c
+++ b/lem/io/core.c
@@ -37,14 +37,15 @@
#include <sys/ucred.h>
#include <netinet/in.h>
extern char **environ;
-#ifndef UNIX_PATH_MAX
-#define UNIX_PATH_MAX 104
-#endif
#else
-#include <linux/un.h>
+#include <sys/un.h>
#include <sys/sendfile.h>
#endif
+#ifndef UNIX_PATH_MAX
+#define UNIX_PATH_MAX (sizeof ((struct sockaddr_un *)0)->sun_path)
+#endif
+
#include <lem-parsers.h>
static int