Merge ~liushuyu-011/ubuntu/+source/x11vnc:ubuntu/devel into ubuntu/+source/x11vnc:ubuntu/devel

Proposed by Zixing Liu
Status: Needs review
Proposed branch: ~liushuyu-011/ubuntu/+source/x11vnc:ubuntu/devel
Merge into: ubuntu/+source/x11vnc:ubuntu/devel
Diff against target: 116 lines (+94/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch (+86/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Benjamin Drung (community) Approve
Review via email: mp+462832@code.launchpad.net

Description of the change

This MP adds a patch to fix 64-bit time_t compatibility issues on 32-bit systems by replacing gettimeofday calls with clock_gettime calls.

To post a comment you must log in.
Revision history for this message
Zixing Liu (liushuyu-011) wrote :
Revision history for this message
Benjamin Drung (bdrung) wrote :

Sponsored with the spaces fixed to tabs.

review: Approve
Revision history for this message
Benjamin Drung (bdrung) :

Unmerged commits

a0c54ea... by Zixing Liu

d/p/0007-use-clock_gettime-to-replace-gettimeofday.patch: Add a patch to fix ...

... time_t compatibility issues

b772ad5... by Steve Langasek

0.9.16-9build1 (patches unapplied)

Imported using git-ubuntu import.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 180aafb..e4f79ff 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+x11vnc (0.9.16-9ubuntu1) noble; urgency=medium
7+
8+ * debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch:
9+ Use clock_gettime to replace gettimeofday.
10+
11+ -- Zixing Liu <zixing.liu@canonical.com> Wed, 20 Mar 2024 20:26:54 -0600
12+
13 x11vnc (0.9.16-9build1) noble; urgency=medium
14
15 * No-change rebuild against libssl3t64
16diff --git a/debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch b/debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch
17new file mode 100644
18index 0000000..65f6adb
19--- /dev/null
20+++ b/debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch
21@@ -0,0 +1,86 @@
22+Description: Use clock_gettime to replace gettimeofday
23+ So that the program is compatible with 64-bit time_t types on 32-bit systems
24+Author: Zixing Liu <zixing.liu@canonical.com>
25+Forwarded: no
26+Last-Update: 2024-03-21
27+
28+Index: x11vnc/src/uinput.c
29+===================================================================
30+--- x11vnc.orig/src/uinput.c
31++++ x11vnc/src/uinput.c
32+@@ -710,6 +710,7 @@ void parse_uinput_str(char *in) {
33+ static void ptr_move(int dx, int dy) {
34+ #ifdef UINPUT_OK
35+ struct input_event ev;
36++ struct timespec tv;
37+ int d = direct_rel_fd < 0 ? fd : direct_rel_fd;
38+
39+ if (injectable && strchr(injectable, 'M') == NULL) {
40+@@ -720,7 +721,9 @@ static void ptr_move(int dx, int dy) {
41+
42+ if (db) fprintf(stderr, "ptr_move(%d, %d) fd=%d\n", dx, dy, d);
43+
44+- gettimeofday(&ev.time, NULL);
45++ clock_gettime(CLOCK_REALTIME, &tv);
46++ ev.input_event_sec = tv.tv_sec;
47++ ev.input_event_usec = tv.tv_nsec / 1000;
48+ ev.type = EV_REL;
49+ ev.code = REL_Y;
50+ ev.value = dy;
51+@@ -755,6 +758,7 @@ static void apply_tslib(int *x, int *y)
52+ static void ptr_abs(int x, int y, int p) {
53+ #ifdef UINPUT_OK
54+ struct input_event ev;
55++ struct timespec tv;
56+ int x0, y0;
57+ int d = direct_abs_fd < 0 ? fd : direct_abs_fd;
58+
59+@@ -773,7 +777,9 @@ static void ptr_abs(int x, int y, int p)
60+
61+ if (db) fprintf(stderr, "ptr_abs(%d, %d => %d %d, p=%d) fd=%d\n", x0, y0, x, y, p, d);
62+
63+- gettimeofday(&ev.time, NULL);
64++ clock_gettime(CLOCK_REALTIME, &tv);
65++ ev.input_event_sec = tv.tv_sec;
66++ ev.input_event_usec = tv.tv_nsec / 1000;
67+ ev.type = EV_ABS;
68+ ev.code = ABS_Y;
69+ ev.value = y;
70+@@ -950,6 +956,7 @@ if (0) {usleep(100*1000) ;}
71+ static void button_click(int down, int btn) {
72+ #ifdef UINPUT_OK
73+ struct input_event ev;
74++ struct timespec tv;
75+ int d = direct_btn_fd < 0 ? fd : direct_btn_fd;
76+
77+ if (injectable && strchr(injectable, 'B') == NULL) {
78+@@ -959,7 +966,9 @@ static void button_click(int down, int b
79+ if (db) fprintf(stderr, "button_click: btn %d %s fd=%d\n", btn, down ? "down" : "up", d);
80+
81+ memset(&ev, 0, sizeof(ev));
82+- gettimeofday(&ev.time, NULL);
83++ clock_gettime(CLOCK_REALTIME, &tv);
84++ ev.input_event_sec = tv.tv_sec;
85++ ev.input_event_usec = tv.tv_nsec / 1000;
86+ ev.type = EV_KEY;
87+ ev.value = down;
88+
89+@@ -1230,6 +1239,7 @@ void uinput_pointer_command(int mask, in
90+ void uinput_key_command(int down, int keysym, rfbClientPtr client) {
91+ #ifdef UINPUT_OK
92+ struct input_event ev;
93++ struct timespec tv;
94+ int scancode;
95+ allowed_input_t input;
96+ int d = direct_key_fd < 0 ? fd : direct_key_fd;
97+@@ -1253,7 +1263,9 @@ void uinput_key_command(int down, int ke
98+ if (db) fprintf(stderr, "uinput_key_command: %d -> %d %s fd=%d\n", keysym, scancode, down ? "down" : "up", d);
99+
100+ memset(&ev, 0, sizeof(ev));
101+- gettimeofday(&ev.time, NULL);
102++ clock_gettime(CLOCK_REALTIME, &tv);
103++ ev.input_event_sec = tv.tv_sec;
104++ ev.input_event_usec = tv.tv_nsec / 1000;
105+ ev.type = EV_KEY;
106+ ev.code = (unsigned char) scancode;
107+ ev.value = down;
108diff --git a/debian/patches/series b/debian/patches/series
109index e623b2c..3284f17 100644
110--- a/debian/patches/series
111+++ b/debian/patches/series
112@@ -5,3 +5,4 @@
113 0004-x11vnc.ftbfs-gcc10.patch
114 0005-scan-limit-access-to-shared-memory-segments-to-curre.patch
115 0006-fix-manpage-acute-accents.patch
116+0007-use-clock_gettime-to-replace-gettimeofday.patch

Subscribers

People subscribed via source and target branches

to all changes: