summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2013-11-10 12:04:41 +0800
committerLAN-TW <lantw44@gmail.com>2013-11-10 12:04:41 +0800
commit782de2cc87daa59de9952c0924851514aa7470e1 (patch)
treea3c703f8c3d5fa487446bc3de7d064170c7fb4b6
parent5793c733dd51289d24d68798ec828763c6b4d6e7 (diff)
downloadcn2013-782de2cc87daa59de9952c0924851514aa7470e1.tar.gz
cn2013-782de2cc87daa59de9952c0924851514aa7470e1.tar.zst
cn2013-782de2cc87daa59de9952c0924851514aa7470e1.zip
HW1: 修正在 BSD 上無法成功設定 controlling terminal 的問題
-rw-r--r--hw1/configure.ac4
-rw-r--r--hw1/session.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/hw1/configure.ac b/hw1/configure.ac
index 7946ab8..d6b8e77 100644
--- a/hw1/configure.ac
+++ b/hw1/configure.ac
@@ -14,14 +14,16 @@ AH_TEMPLATE([_POSIX_C_SOURCE])
AH_TEMPLATE([_XOPEN_SOURCE])
AH_TEMPLATE([_BSD_SOURCE])
AH_TEMPLATE([_WITH_GETLINE])
+AH_TEMPLATE([OS_IS_BSD])
case "$host_os" in
*gnu*)
AC_DEFINE([_POSIX_C_SOURCE], [200809L])
AC_DEFINE([_XOPEN_SOURCE], [700])
AC_DEFINE([_BSD_SOURCE])
;;
- *freebsd*)
+ *bsd*)
AC_DEFINE([_WITH_GETLINE])
+ AC_DEFINE([OS_IS_BSD])
;;
esac
diff --git a/hw1/session.c b/hw1/session.c
index 07f25c9..25525c6 100644
--- a/hw1/session.c
+++ b/hw1/session.c
@@ -308,7 +308,7 @@ int ras_session_start_shell (RasSession* session) {
ras_session_log (session, "cannot open slave pty: %s", strerror (errno));
exit (1);
}
-#ifdef BSD
+#ifdef OS_IS_BSD
if (ioctl (child_stdio, TIOCSCTTY, NULL) < 0) {
write (RAS_CONN (session)->fd, nopty_msg, nopty_len);
ras_session_log (session, "cannot set controlling terminal: %s", strerror (errno));