- do not ooops in gpm when console device cannot be found, print an error

message instead and exit(1), as per BR 140025, 176178
- do not print messages in libgpm, unless envvar GPM_VERBOSE is set --
    avoids unwanted clutter from libgpm in apps like dialog or mc when gpm
    is not available
This commit is contained in:
prockai 2006-01-18 12:07:55 +00:00
parent 323ad04254
commit 1e4ad8c47f
3 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,19 @@
--- gpm-1.20.1/src/lib/report-lib.c.lib-silent 2002-12-24 23:57:16.000000000 +0100
+++ gpm-1.20.1/src/lib/report-lib.c 2006-01-18 17:55:38.000000000 +0100
@@ -24,8 +24,16 @@
#include "headers/message.h"
+static int gpm_silent() {
+ if ( getenv( "GPM_VERBOSE" ) == NULL ) return 1;
+ return 0;
+}
+
void gpm_report(int line, char *file, int stat, char *text, ... )
{
+ if ( gpm_silent() && stat != GPM_STAT_OOPS )
+ return;
+
char *string = NULL;
va_list ap;
va_start(ap,text);

View File

@ -0,0 +1,15 @@
--- gpm-1.20.1/src/console.c.no-console-error 2006-01-18 17:06:15.000000000 +0100
+++ gpm-1.20.1/src/console.c 2006-01-18 17:08:19.000000000 +0100
@@ -249,8 +249,10 @@
/* Failed, try OLD console */
else if (stat(GPM_OLD_CONSOLE, &buf) == 0)
console.device = GPM_OLD_CONSOLE;
- else
- gpm_report(GPM_PR_OOPS, "Can't determine console device");
+ else { // XXX handle this gracefully?
+ fprintf( stderr, "no console device found" );
+ exit( 1 );
+ }
return console.device;
}

View File

@ -1,7 +1,7 @@
Summary: A mouse server for the Linux console.
Name: gpm
Version: 1.20.1
Release: 72
Release: 73
License: GPL
Group: System Environment/Daemons
Source: http://ftp.linux.it/pub/People/rubini/gpm/%{name}-%{version}.tar.gz
@ -17,6 +17,8 @@ Patch16: gpm-1.20.1-subscript.patch
Patch17: gpm-1.20.1-input.patch
Patch18: gpm-1.20.1-consolename.patch
Patch19: gpm-1.20.1-multilib.patch
Patch20: gpm-1.20.1-no-console-error.patch
Patch21: gpm-1.20.1-lib-silent.patch
Prereq: /sbin/chkconfig /sbin/ldconfig /sbin/install-info
Requires: bash >= 2.0
@ -58,6 +60,8 @@ mouse button.
%patch17 -p1 -b .input
%patch18 -p1 -b .consolename
%patch19 -p1 -b .multilib
%patch20 -p1 -b .no-console-error
%patch21 -p1 -b .lib-silent
%build
autoconf
@ -174,6 +178,13 @@ fi
%{_libdir}/libgpm.so
%changelog
* Wed Jan 18 2006 Petr Rockai <prockai@redhat.com> 1.20.1-73
- do not ooops in gpm when console device cannot be found, print
an error message instead and exit(1), as per BR 140025, 176178
- do not print messages in libgpm, unless envvar GPM_VERBOSE
is set -- avoids unwanted clutter from libgpm in apps like dialog
or mc when gpm is not available
* Thu Dec 22 2005 Jesse Keating <jkeating@redhat.com> 1.20.1-72
- rebuilt again