termux-packages/x11-packages/qtermwidget/utmp_android.patch

50 lines
945 B
Diff

--- src/lib/kpty.cpp 2021-05-12 15:09:15.461686000 +0000
+++ src.mod/lib/kpty.cpp 2021-05-12 15:24:03.750599000 +0000
@@ -32,6 +32,10 @@
#define HAVE_LIBUTIL_H
#endif
+#if defined(__ANDROID__)
+#define HAVE_PTY_H
+#endif
+
#if defined(__OpenBSD__)
#define HAVE_LOGIN
#define HAVE_UTIL_H
@@ -588,10 +592,12 @@
# endif
# else
utmpname(_PATH_UTMP);
+#ifndef __ANDROID__
setutent();
pututline(&l_struct);
endutent();
updwtmp(_PATH_WTMP, &l_struct);
+#endif
# endif
# endif
#endif
@@ -641,7 +647,12 @@
# else
utmpname(_PATH_UTMP);
setutent();
+
+#ifndef __ANDROID__
if ((ut = getutline(&l_struct))) {
+#else
+ if ((ut = getutent())) {
+#endif
# endif
# ifdef HAVE_UTMPX
memset(ut->ut_user, 0, sizeof(*ut->ut_user));
@@ -662,7 +673,9 @@
endutxent();
# else
ut->ut_time = time(nullptr);
+#ifndef __ANDROID__
pututline(ut);
+#endif
}
endutent();
# endif