[PATCH weston 2/5] input: don't assume outputs have names

Derek Foreman derekf at osg.samsung.com
Tue Mar 17 11:22:35 PDT 2015


If an output is unnamed and devices are in seats, the strcmp will crash.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 src/libinput-seat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libinput-seat.c b/src/libinput-seat.c
index ef2d804..c0a87ea 100644
--- a/src/libinput-seat.c
+++ b/src/libinput-seat.c
@@ -82,7 +82,8 @@ device_added(struct udev_input *input, struct libinput_device *libinput_device)
 	if (output_name) {
 		device->output_name = strdup(output_name);
 		wl_list_for_each(output, &c->output_list, link)
-			if (strcmp(output->name, device->output_name) == 0)
+			if (output->name &&
+			    strcmp(output->name, device->output_name) == 0)
 				evdev_device_set_output(device, output);
 	} else if (device->output == NULL && !wl_list_empty(&c->output_list)) {
 		output = container_of(c->output_list.next,
-- 
2.1.4



More information about the wayland-devel mailing list