summaryrefslogtreecommitdiff
path: root/packages/gpe-conf/files/fixsegfault.patch
blob: 7f1ccbe43259f2151b764ec34aaee5cc23600316 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Index: network.c
===================================================================
RCS file: /cvs/gpe/base/gpe-conf/network.c,v
retrieving revision 1.55.2.2
retrieving revision 1.55.2.3
diff -u -r1.55.2.2 -r1.55.2.3
--- network.c	16 Feb 2006 22:32:30 -0000	1.55.2.2
+++ network.c	20 Feb 2006 01:34:44 -0000	1.55.2.3
@@ -289,19 +289,23 @@
 			i = iflen-1;
 			
 			fd = fopen(_PATH_PROCNET_WIRELESS, "r");
-			fgets(buffer, 256, fd);		// chuck first two lines;
-			fgets(buffer, 256, fd);
-			while (!feof(fd)) {
-				if (fgets(buffer, 256, fd) == NULL)
-					break;
-				name = buffer;
-				sep = strrchr(buffer, ':');
-				if (sep) *sep = 0;
-				while(*name == ' ') name++;
-				if (!strcmp(name, ifname))
-					iflist[iflen - 1].iswireless = TRUE;
-			}
+			if (fd != NULL)
+			{
+				fgets(buffer, 256, fd);		// chuck first two lines;
+				fgets(buffer, 256, fd);
+				while (!feof(fd)) 
+				{
+					if (fgets(buffer, 256, fd) == NULL)
+						break;
+					name = buffer;
+					sep = strrchr(buffer, ':');
+					if (sep) *sep = 0;
+					while(*name == ' ') name++;
+					if (!strcmp(name, ifname))
+						iflist[iflen - 1].iswireless = TRUE;
+				}
 			fclose(fd);
+			}
 		}
 		else
 			i = existing;