Package: lshw Version: 02.10-4 Priority: normal Tags: patch If I run 'lshw -X' without having the lshw-gtk package installed I get the same output as running it without -X. There is no indication on either stderr/stdout that the GTK application cannot be launched and what should I do.
Ideally, if running 'lshw -X' when /usr/bin/gtk-lshw is not present should say something like: Sorry, cannot run the X11/GTK interface because /usr/bin/gtk-lshw is not available. Hint: Install the lshw-gtk package in Debian. The attached patch should fix this bug by introducing the behaviour described previously. Regards Javier
--- lshw.cc.orig 2007-07-25 16:14:34.000000000 +0200
+++ lshw.cc 2007-07-25 16:25:27.000000000 +0200
@@ -8,7 +8,9 @@
#include <unistd.h>
#include <stdio.h>
+#include <stdlib.h>
#include <iostream>
+#include <errno.h>
__ID("@(#) $Id: lshw.cc 1726 2007-02-13 21:38:11Z lyonel $");
@@ -142,7 +144,17 @@
exit(1);
}
- if(X) execl(SBINDIR"/gtk-lshw", SBINDIR"/gtk-lshw", NULL);
+ if(X) {
+ execl(SBINDIR"/gtk-lshw", SBINDIR"/gtk-lshw", NULL);
+ // Execl only returns if an error has occurred.
+ if ( errno == ENOENT ) {
+ fprintf(stderr, "ERROR: Sorry, cannot run the X11/GTK interface because %s/gtk-lshw\n is not available.\n", SBINDIR);
+ fprintf(stderr, "HINT: Install the lshw-gtk package in Debian.\n");
+ } else {
+ fprintf(stderr, "ERROR: There was an error when trying to execute %s/gtk-lshw: %s\n", SBINDIR, strerror(errno));
+ fprintf(stderr, "Will just print the information on screen\n");
+ }
+ }
if (geteuid() != 0)
{
signature.asc
Description: Digital signature

