[jfbterm/f15/master] Attempt to fix hang or segv with invalid ut_id on wtmp refresh (bug 698532)
Mamoru Tasaka
mtasaka at fedoraproject.org
Fri Apr 29 19:06:41 UTC 2011
commit 8f7e99620c174e9a8535e3a0e861aaf41fb9ea28
Author: Mamoru Tasaka <tasaka1 at localhost.localdomain>
Date: Sat Apr 30 04:06:31 2011 +0900
Attempt to fix hang or segv with invalid ut_id on wtmp refresh
(bug 698532)
....7-hang-on-utmp-refresh-with-invalid-utid.patch | 62 ++++++++++++++++++++
jfbterm.spec | 10 +++-
2 files changed, 71 insertions(+), 1 deletions(-)
---
diff --git a/jfbterm-0.4.7-hang-on-utmp-refresh-with-invalid-utid.patch b/jfbterm-0.4.7-hang-on-utmp-refresh-with-invalid-utid.patch
new file mode 100644
index 0000000..afb1c46
--- /dev/null
+++ b/jfbterm-0.4.7-hang-on-utmp-refresh-with-invalid-utid.patch
@@ -0,0 +1,62 @@
+--- jfbterm-0.4.7/term.c.debug 2011-04-29 00:14:18.000000000 +0900
++++ jfbterm-0.4.7/term.c 2011-04-30 03:47:39.000000000 +0900
+@@ -267,6 +267,18 @@
+ exit(1);
+ }
+
++const char *guess_utid_from_ttyname (const char *devname)
++{
++ if (!devname || !*devname) return NULL;
++
++/*
++ if (!strncmp(devname, "/dev/pts/",9))
++ return devname + 8;
++*/
++ if (!strncmp(devname, "/dev/", 5) && (strlen(devname) >= 9))
++ return devname + 8;
++ return NULL;
++}
+
+ void tterm_set_utmp(TTerm* p)
+ {
+@@ -278,7 +290,7 @@
+ pw = getpwuid(util_getuid());
+ tn = rindex(p->name, '/') + 1;
+ memset((char *)&utmp, 0, sizeof(utmp));
+- strncpy(utmp.ut_id, tn + 3, sizeof(utmp.ut_id));
++ strncpy(utmp.ut_id, guess_utid_from_ttyname(p->name), sizeof(utmp.ut_id));
+ utmp.ut_type = DEAD_PROCESS;
+ setutent();
+ getutid(&utmp);
+@@ -298,20 +310,22 @@
+ {
+ struct utmp utmp, *utp;
+ time_t tmp_ut_time;
+- char *tn;
++ /*char *tn;*/
+
+- tn = rindex(p->name, '/') + 4;
++ /*tn = rindex(p->name, '/') + 4;*/
+ memset((char *)&utmp, 0, sizeof(utmp));
+- strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id));
++ strncpy(utmp.ut_id, guess_utid_from_ttyname(p->name), sizeof(utmp.ut_id));
+ utmp.ut_type = USER_PROCESS;
+ setutent();
+ utp = getutid(&utmp);
+- utp->ut_type = DEAD_PROCESS;
+- memset(utp->ut_user, 0, sizeof(utmp.ut_user));
+- utp->ut_type = DEAD_PROCESS;
+- time(&(tmp_ut_time));
+- utp->ut_time = (int32_t) tmp_ut_time;
+- pututline(utp);
++ if (utp){
++ utp->ut_type = DEAD_PROCESS;
++ memset(utp->ut_user, 0, sizeof(utmp.ut_user));
++ utp->ut_type = DEAD_PROCESS;
++ time(&(tmp_ut_time));
++ utp->ut_time = (int32_t) tmp_ut_time;
++ pututline(utp);
++ }
+ endutent();
+ }
+
diff --git a/jfbterm.spec b/jfbterm.spec
index d1b25ac..a2cc390 100644
--- a/jfbterm.spec
+++ b/jfbterm.spec
@@ -7,7 +7,7 @@
Summary: Japanese Console for Linux Frame Buffer Device
Name: jfbterm
Version: 0.4.7
-Release: 24%{?dist}
+Release: 25S%{?dist}
License: BSD
Group: Applications/System
Source0: http://downloads.sourceforge.jp/jfbterm/13501/jfbterm-%{version}.tar.gz
@@ -26,6 +26,9 @@ Patch13: jfbterm-0.4.7-pagemask_userspace.patch
%if 0%{?fedora} == 8
Patch14: jfbterm-0.4.7-string_h-memmove.patch
%endif
+# Some people see jfbterm hang or segv with invalid ut_id
+# (bug 698532)
+Patch15: jfbterm-0.4.7-hang-on-utmp-refresh-with-invalid-utid.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
URL: http://jfbterm.sourceforge.jp/
@@ -79,6 +82,7 @@ Features:
%if 0%{?fedora} == 8
%patch14 -p1 -b .memmove
%endif
+%patch15 -p1 -b .utid_with_refresh
#autoconf
touch Makefile.in aclocal.m4 config.h.in configure stamp-h.in
@@ -205,6 +209,10 @@ iconv -f EUCJP -t UTF8 README.ja.orig > README.ja && \
%endif
%changelog
+* Sat Apr 30 2011 Mamoru Tasaka <mtasaka at fedoraproject.org> - 0.4.7-25
+- Attempt to fix hang or segv with invalid ut_id on wtmp refresh
+ (bug 698532)
+
* Fri Feb 18 2011 Mamoru Tasaka <mtasaka at fedoraproject.org> - 0.4.7-24
- Change the method to kill virtual Provides related to font
on F-15 (bug 677760)
More information about the scm-commits
mailing list