summaryrefslogtreecommitdiff
path: root/legacy/eeze/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-06-29 18:53:38 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-06-29 18:53:38 +0000
commitf2caf4707cab7adb6bb07cceca67ec50927d0115 (patch)
tree7270bd02ac75981e1f6f93b2c5923e5c2d729809 /legacy/eeze/src
parent47cdbe390a8a0906e1d0bef6014bf29271970277 (diff)
fix some segvs and drive detection
SVN revision: 60832
Diffstat (limited to 'legacy/eeze/src')
-rw-r--r--legacy/eeze/src/lib/eeze_udev_watch.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/legacy/eeze/src/lib/eeze_udev_watch.c b/legacy/eeze/src/lib/eeze_udev_watch.c
index 19d3413918..03bbabbfc4 100644
--- a/legacy/eeze/src/lib/eeze_udev_watch.c
+++ b/legacy/eeze/src/lib/eeze_udev_watch.c
@@ -66,39 +66,40 @@ _get_syspath_from_watch(void *data,
66 { 66 {
67 if (!strcmp(test, "add")) 67 if (!strcmp(test, "add"))
68 { 68 {
69 if ((store->event & EEZE_UDEV_EVENT_ADD) != EEZE_UDEV_EVENT_ADD) 69 if ((store->event != EEZE_UDEV_EVENT_NONE) &&
70 ((store->event & EEZE_UDEV_EVENT_ADD) != EEZE_UDEV_EVENT_ADD))
70 goto error; 71 goto error;
71 72
72 event |= EEZE_UDEV_EVENT_ADD; 73 event |= EEZE_UDEV_EVENT_ADD;
73 } 74 }
74 else if (!strcmp(test, "remove")) 75 else if (!strcmp(test, "remove"))
75 { 76 {
76 if ((store->event & EEZE_UDEV_EVENT_REMOVE) != 77 if ((store->event != EEZE_UDEV_EVENT_NONE) &&
77 EEZE_UDEV_EVENT_REMOVE) 78 ((store->event & EEZE_UDEV_EVENT_REMOVE) != EEZE_UDEV_EVENT_REMOVE))
78 goto error; 79 goto error;
79 80
80 event |= EEZE_UDEV_EVENT_REMOVE; 81 event |= EEZE_UDEV_EVENT_REMOVE;
81 } 82 }
82 else if (!strcmp(test, "change")) 83 else if (!strcmp(test, "change"))
83 { 84 {
84 if ((store->event & EEZE_UDEV_EVENT_CHANGE) != 85 if ((store->event != EEZE_UDEV_EVENT_NONE) &&
85 EEZE_UDEV_EVENT_CHANGE) 86 ((store->event & EEZE_UDEV_EVENT_CHANGE) != EEZE_UDEV_EVENT_CHANGE))
86 goto error; 87 goto error;
87 88
88 event |= EEZE_UDEV_EVENT_CHANGE; 89 event |= EEZE_UDEV_EVENT_CHANGE;
89 } 90 }
90 else if (!strcmp(test, "online")) 91 else if (!strcmp(test, "online"))
91 { 92 {
92 if ((store->event & EEZE_UDEV_EVENT_ONLINE) != 93 if ((store->event != EEZE_UDEV_EVENT_NONE) &&
93 EEZE_UDEV_EVENT_ONLINE) 94 ((store->event & EEZE_UDEV_EVENT_ONLINE) != EEZE_UDEV_EVENT_ONLINE))
94 goto error; 95 goto error;
95 96
96 event |= EEZE_UDEV_EVENT_ONLINE; 97 event |= EEZE_UDEV_EVENT_ONLINE;
97 } 98 }
98 else 99 else
99 { 100 {
100 if ((store->event & EEZE_UDEV_EVENT_OFFLINE) != 101 if ((store->event != EEZE_UDEV_EVENT_NONE) &&
101 EEZE_UDEV_EVENT_OFFLINE) 102 ((store->event & EEZE_UDEV_EVENT_OFFLINE) != EEZE_UDEV_EVENT_OFFLINE))
102 goto error; 103 goto error;
103 104
104 event |= EEZE_UDEV_EVENT_OFFLINE; 105 event |= EEZE_UDEV_EVENT_OFFLINE;
@@ -187,14 +188,14 @@ _get_syspath_from_watch(void *data,
187 case EEZE_UDEV_TYPE_DRIVE_INTERNAL: 188 case EEZE_UDEV_TYPE_DRIVE_INTERNAL:
188 if (udev_device_get_property_value(device, "ID_FS_USAGE")) goto error; 189 if (udev_device_get_property_value(device, "ID_FS_USAGE")) goto error;
189 test = udev_device_get_sysattr_value(device, "removable"); 190 test = udev_device_get_sysattr_value(device, "removable");
190 if (test[0] == '1') goto error; 191 if (test && test[0] == '1') goto error;
191 192
192 break; 193 break;
193 194
194 case EEZE_UDEV_TYPE_DRIVE_REMOVABLE: 195 case EEZE_UDEV_TYPE_DRIVE_REMOVABLE:
195 if (udev_device_get_property_value(device, "ID_FS_USAGE")) goto error; 196 if (udev_device_get_property_value(device, "ID_FS_USAGE")) goto error;
196 test = udev_device_get_sysattr_value(device, "removable"); 197 test = udev_device_get_sysattr_value(device, "removable");
197 if (test[0] == '0') goto error; 198 if ((!test) || (test[0] == '0')) goto error;
198 199
199 break; 200 break;
200 201