Files
MSYS2-packages/util-linux/2.40.2-agetty.patch
2025-02-06 12:47:39 -08:00

49 lines
1.3 KiB
Diff

--- origsrc/util-linux-2.40.2/term-utils/agetty.c 2024-07-04 00:54:41.396241100 -0700
+++ src/util-linux-2.40.2/term-utils/agetty.c 2024-10-24 21:24:07.465151300 -0700
@@ -83,7 +83,7 @@
#ifdef __linux__
# include <sys/kd.h>
# define USE_SYSLOG
-#elif defined(__GNU__)
+#elif defined(__GNU__) || defined(__CYGWIN__)
# define USE_SYSLOG
#endif
@@ -1029,7 +1029,9 @@ static void update_utmp(struct options *
ut.ut_tv.tv_sec = t;
ut.ut_type = LOGIN_PROCESS;
ut.ut_pid = pid;
+#ifndef __CYGWIN__
ut.ut_session = sid;
+#endif
pututxline(&ut);
endutxent();
@@ -1101,8 +1103,12 @@ static void open_tty(const char *tty, st
if (op->flags & F_HANGUP) {
+#ifdef TIOCNOTTY
if (ioctl(fd, TIOCNOTTY))
debug("TIOCNOTTY ioctl failed\n");
+#else
+ setsid();
+#endif
/*
* Let's close all file descriptors before vhangup
@@ -2349,11 +2355,11 @@ static void termio_final(struct options
tp->c_cc[VQUIT] = DEF_QUIT;
tp->c_cc[VEOF] = DEF_EOF;
tp->c_cc[VEOL] = DEF_EOL;
-#ifdef __linux__
+#if defined(__linux__) || defined(__CYGWIN__)
tp->c_cc[VSWTC] = DEF_SWITCH;
#elif defined(VSWTCH)
tp->c_cc[VSWTCH] = DEF_SWITCH;
-#endif /* __linux__ */
+#endif /* __linux__ || __CYGWIN__ */
/* Account for special characters seen in input. */
if (cp->eol == CR) {