Merge lp:~bregma/geis/lp-956538 into lp:geis

Proposed by Stephen M. Webb
Status: Merged
Merged at revision: 218
Proposed branch: lp:~bregma/geis/lp-956538
Merge into: lp:geis
Diff against target: 72 lines (+21/-4)
1 file modified
libutouch-geis/geis_backend_multiplexor.c (+21/-4)
To merge this branch: bzr merge lp:~bregma/geis/lp-956538
Reviewer Review Type Date Requested Status
Chase Douglas (community) Approve
Review via email: mp+97777@code.launchpad.net

Description of the change

Fixes FTBFS in PPAs (lp: #956538).

Problem was caused by an ancient kernel version in the PPA coupled with poor error handling in geis_new().

To post a comment you must log in.
Revision history for this message
Chase Douglas (chasedouglas) wrote :

Good bug hunting!

This brings up an amusing fact:

We now can initialize on a pre-2.6.27 kernel, but we can't actually do anything until a 2.6.31 kernel since that's when the first evdev MT protocol was merged.

So, all this just to make a compilation check test work :).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libutouch-geis/geis_backend_multiplexor.c'
2--- libutouch-geis/geis_backend_multiplexor.c 2011-10-17 21:50:41 +0000
3+++ libutouch-geis/geis_backend_multiplexor.c 2012-03-16 00:27:18 +0000
4@@ -2,7 +2,7 @@
5 * @file geis_backend_multiplexor.c
6 * @brief internal GEIS backend multiplexor implementation
7 *
8- * Copyright 2010 Canonical Ltd.
9+ * Copyright 2010, 2012 Canonical Ltd.
10 *
11 * This library is free software; you can redistribute it and/or modify it under
12 * the terms of the GNU Lesser General Public License as published by the Free
13@@ -22,10 +22,12 @@
14 #include "geis_backend_multiplexor.h"
15
16 #include <errno.h>
17+#include <fcntl.h>
18 #include "geis_logging.h"
19 #include <stdlib.h>
20 #include <string.h>
21 #include <sys/epoll.h>
22+#include <unistd.h>
23
24
25 typedef struct CallbackInfo *CallbackInfo;
26@@ -220,22 +222,36 @@
27 }
28 else
29 {
30- mx->mx_fd = epoll_create1(EPOLL_CLOEXEC);
31+ mx->mx_fd = epoll_create(5);
32 if (mx->mx_fd < 0)
33 {
34 geis_error("error %d creating backend multiplexor: %s",
35 errno, strerror(errno));
36- free(mx);
37- }
38+ goto unwind_mx;
39+ }
40+ if (fcntl(mx->mx_fd, F_SETFD, FD_CLOEXEC) < 0)
41+ {
42+ geis_error("error %d setting close-on-exec flag: %s",
43+ errno, strerror(errno));
44+ }
45+
46 mx->mx_max_events_per_pump = GEIS_BE_MX_DEFAULT_EVENTS_PER_PUMP;
47
48 mx->mx_callback_infos = _callback_info_bag_new();
49 if (!mx->mx_callback_infos)
50 {
51 geis_error("failed to allocate backend multiplexor callback_infos");
52+ goto unwind_epoll;
53 }
54 }
55+ goto final_exit;
56
57+unwind_epoll:
58+ close(mx->mx_fd);
59+unwind_mx:
60+ free(mx);
61+ mx = NULL;
62+final_exit:
63 return mx;
64 }
65
66@@ -247,6 +263,7 @@
67 geis_backend_multiplexor_delete(GeisBackendMultiplexor mx)
68 {
69 _callback_info_bag_delete(mx->mx_callback_infos);
70+ close(mx->mx_fd);
71 free(mx);
72 }
73

Subscribers

People subscribed via source and target branches