aboutsummaryrefslogtreecommitdiffstats
path: root/src/ttyname_r.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ttyname_r.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ttyname_r.c b/src/ttyname_r.c
index 44876587..810c2175 100644
--- a/src/ttyname_r.c
+++ b/src/ttyname_r.c
@@ -24,10 +24,14 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
-#warning ttyname is not thread-safe, and ttyname_r is missing
+#ifdef __GNUC__
+# warning ttyname is not thread-safe, and ttyname_r is missing
+#endif
int
ttyname_r (int fd, char *buf, size_t buflen)