- the patch for #168076 caused a strange behaviour with ncurses, fixed it

differently
This commit is contained in:
Tomas Janousek 2007-03-23 16:26:11 +00:00
parent 6df923c100
commit 287990bc1b
2 changed files with 17 additions and 51 deletions

View File

@ -1,56 +1,17 @@
--- gpm-1.20.1/src/gpm.c.deadsocket 2007-01-22 12:53:19.000000000 +0100
+++ gpm-1.20.1/src/gpm.c 2007-01-22 12:49:54.000000000 +0100
@@ -544,7 +544,7 @@
--- gpm-1.20.1/src/gpm.c.deadsocket 2007-03-23 16:59:42.000000000 +0100
+++ gpm-1.20.1/src/gpm.c 2007-03-23 17:10:10.000000000 +0100
@@ -544,7 +544,14 @@
* we can safely use micelist
*/
close(micelist->dev.fd);
- wait_text_console();
+ wait_text_console(ctlfd);
+
+ close(ctlfd);
+ FD_CLR(ctlfd, &connSet);
wait_text_console();
+ ctlfd = listen_for_clients();
+ FD_SET(ctlfd, &connSet);
+ maxfd = max(maxfd, ctlfd);
+
/* reopen, reinit (the function is only used if we have one mouse device) */
if ((micelist->dev.fd = open(micelist->device, O_RDWR)) < 0)
gpm_report(GPM_PR_OOPS, GPM_MESS_OPEN, micelist->device);
--- gpm-1.20.1/src/console.c.deadsocket 2007-01-22 00:50:25.000000000 +0100
+++ gpm-1.20.1/src/console.c 2007-01-22 13:08:18.000000000 +0100
@@ -101,7 +101,7 @@
}
/*-------------------------------------------------------------------*/
-void wait_text_console(void)
+void wait_text_console(int ctlfd)
{
struct timeval now;
int usecs;
@@ -113,7 +113,21 @@
usecs -= 1000000;
usecs += 1000000 - now.tv_usec;
- usleep(usecs);
+ now.tv_sec = 0;
+ now.tv_usec = usecs;
+
+ /* check for pending connections and reject them */
+ fd_set fds;
+ FD_ZERO(&fds);
+ FD_SET(ctlfd, &fds);
+
+ select(ctlfd + 1, &fds, 0, 0, &now);
+
+ if (FD_ISSET(ctlfd, &fds) && !is_text_console()) {
+ int fd = accept(ctlfd, 0, 0);
+ if (fd >= 0)
+ close(fd);
+ }
} while (!is_text_console());
}
--- gpm-1.20.1/src/headers/console.h.deadsocket 2007-01-22 12:53:27.000000000 +0100
+++ gpm-1.20.1/src/headers/console.h 2007-01-22 12:51:49.000000000 +0100
@@ -33,7 +33,7 @@
char *get_console_name();
char *compose_vc_name(int vc);
int is_text_console(void);
-void wait_text_console(void);
+void wait_text_console(int ctlfd);
void refresh_console_size(void);
int is_console_owner(int vc, uid_t uid);
int get_console_state(unsigned char *shift_state);

View File

@ -1,7 +1,7 @@
Summary: A mouse server for the Linux console.
Name: gpm
Version: 1.20.1
Release: 80%{?dist}
Release: 81%{?dist}
License: GPL
Group: System Environment/Daemons
Source: http://ftp.linux.it/pub/People/rubini/gpm/%{name}-%{version}.tar.gz
@ -70,6 +70,7 @@ mouse button.
%patch24 -p1 -b .deadsocket
%build
rm -f configure
autoconf
CFLAGS="-D_GNU_SOURCE $RPM_OPT_FLAGS" \
lispdir=%{buildroot}%{_datadir}/emacs/site-lisp \
@ -185,6 +186,10 @@ fi
%{_libdir}/libgpm.so
%changelog
* Fri Mar 23 2007 Tomas Janousek <tjanouse@redhat.com> - 1.20.1-81
- the patch for #168076 caused a strange behaviour with ncurses, fixed it
differently
* Mon Jan 22 2007 Tomas Janousek <tjanouse@redhat.com> - 1.20.1-80
- forgot to add the patch for #168076