summaryrefslogtreecommitdiff
blob: 710d29e93976f759c0ce24db43bb592f9da50eb9 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From a7e49fefde18ea8d5bada8096d32f23bcfb5a6dc Mon Sep 17 00:00:00 2001
From: Federico G. Schwindt <fgsch@openbsd.org>
Date: Mon, 17 Feb 2014 14:48:12 +0000
Subject: Fix crash on 32bit architectures where time_t is 64 bit

This is an ABI change on platforms where sizeof(time_t) doesn't equal
sizeof(long). For most platforms this change shouldn't make a difference
at present. OpenBSD recently switched to 64bit time_t on all architectures
to avoid time_t overflow in 2038 on 32bit machines.

This fix extends to consumers of startup-notification, for instance
the window manager of XFCE, which is how I got involved in this.
See http://mail.xfce.org/pipermail/xfce4-dev/2014-February/030611.html
and follow-ups. The XFCE devs pointed out that my patch to fix a
crash in XFCE's window manager depends on this startup-notification patch.

Signed-off-by: Julien Danjou <julien@danjou.info>
---
diff --git a/libsn/sn-monitor.c b/libsn/sn-monitor.c
index 2a9ad16..f419bc1 100644
--- a/libsn/sn-monitor.c
+++ b/libsn/sn-monitor.c
@@ -364,8 +364,8 @@ sn_startup_sequence_get_screen (SnStartupSequence *sequence)
  **/
 void
 sn_startup_sequence_get_initiated_time (SnStartupSequence *sequence,
-                                        long              *tv_sec,
-                                        long              *tv_usec)
+                                        time_t            *tv_sec,
+                                        suseconds_t       *tv_usec)
 {
   if (tv_sec)
     *tv_sec = sequence->initiation_time.tv_sec;
@@ -386,8 +386,8 @@ sn_startup_sequence_get_initiated_time (SnStartupSequence *sequence,
  **/
 void
 sn_startup_sequence_get_last_active_time (SnStartupSequence *sequence,
-                                          long              *tv_sec,
-                                          long              *tv_usec)
+                                          time_t            *tv_sec,
+                                          suseconds_t       *tv_usec)
 {
   /* for now the same as get_initiated_time */
   if (tv_sec)
diff --git a/libsn/sn-monitor.h b/libsn/sn-monitor.h
index b58581f..2f639df 100644
--- a/libsn/sn-monitor.h
+++ b/libsn/sn-monitor.h
@@ -77,11 +77,11 @@ const char* sn_startup_sequence_get_application_id        (SnStartupSequence *se
 int         sn_startup_sequence_get_screen                (SnStartupSequence *sequence);
 
 void        sn_startup_sequence_get_initiated_time        (SnStartupSequence *sequence,
-                                                           long              *tv_sec,
-                                                           long              *tv_usec);
+                                                           time_t            *tv_sec,
+                                                           suseconds_t       *tv_usec);
 void        sn_startup_sequence_get_last_active_time      (SnStartupSequence *sequence,
-                                                           long              *tv_sec,
-                                                           long              *tv_usec);
+                                                           time_t            *tv_sec,
+                                                           suseconds_t       *tv_usec);
 
 void        sn_startup_sequence_complete                  (SnStartupSequence *sequence);
 
--
cgit v0.9.0.2-2-gbebe