[schisler_shane bah com: Bug#233830: no check for /proc/bus/usb/devices causes segfault]
- From: Mike Markley <mike markley org>
- To: gnome-pilot-list gnome org
- Subject: [schisler_shane bah com: Bug#233830: no check for /proc/bus/usb/devices causes segfault]
- Date: Thu, 19 Feb 2004 20:48:34 -0800
Thoughts on this?
--
Mike Markley <mike markley org>
--- Begin Message ---
- From: "Schisler Shane" <schisler_shane bah com>
- To: submit bugs debian org
- Subject: Bug#233830: no check for /proc/bus/usb/devices causes segfault
- Date: Thu, 19 Feb 2004 23:22:35 -0700
Package: gnome-pilot
Version: 2.0.10-3
if gpilotd is started and '/proc/bus/usb/devices' doesn't exist, gpilotd
will segfault. The 'devices' file may not exist if the usbfs is not
mounted or if the usb host controller module is not inserted.
here is a patch, I'm using g_warning to notify since g_error causes an
ugly abort message. I don't know if this is the right thing to do since
if you start it thru that little gpilot-applet, you probably won't ever
see the messages unless you looked for them. Maybe this is ok though.
-Shane
diff -urN gnome-pilot-2.0.10.orig/gpilotd/gpilotd.c gnome-pilot-2.0.10/gpilotd/gpilotd.c
--- gnome-pilot-2.0.10.orig/gpilotd/gpilotd.c 2003-07-17 23:57:41.000000000 -0400
+++ gnome-pilot-2.0.10/gpilotd/gpilotd.c 2004-02-19 22:31:27.000000000 -0500
@@ -845,6 +845,7 @@
gboolean visor_exists = FALSE, visor_net = TRUE;
char line[256]; /* this is more than enough to fit any line from
* /proc/bus/usb/devices */
+ char usbpath[] = "/proc/bus/usb/devices";
FILE *f;
@@ -854,7 +855,11 @@
return FALSE;
/* Check /proc/bus/usb/devices for a usb device */
- f = fopen ("/proc/bus/usb/devices", "r");
+ f = fopen (usbpath, "r");
+ if(f == NULL) {
+ g_warning("%s: %s\n", usbpath, strerror(errno));
+ return FALSE;
+ }
while (fgets (line, 255, f) != NULL && !visor_exists) {
if (line[0] != 'P')
--- End Message ---
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]