diff options
author | Christopher Larson <chris_larson@mentor.com> | 2016-12-13 20:52:33 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-09 13:39:13 +0000 |
commit | 904d06ffc90259a8f9f33014a5ec381c94aa0755 (patch) | |
tree | 213e82e11b6105cebb2371b706d20c6d1bd529ae /meta | |
parent | 106a78269370a48aa6139d21500312e7870b9aa5 (diff) | |
download | poky-904d06ffc90259a8f9f33014a5ec381c94aa0755.tar.gz |
gnome-desktop3: fix for x32
Explicitly use strftime+strptime rather than snprintf+atol. This fixes the
build for X32, where long's size doesn't match that of time_t.
(From OE-Core rev: 72fa7d558a43ed053547ddc74972631504e40614)
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch | 72 | ||||
-rw-r--r-- | meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb | 2 |
2 files changed, 74 insertions, 0 deletions
diff --git a/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch b/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch new file mode 100644 index 0000000000..18a069fadc --- /dev/null +++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch | |||
@@ -0,0 +1,72 @@ | |||
1 | From adfa0c8f9fec1faac4bea6a94d947ea32e585923 Mon Sep 17 00:00:00 2001 | ||
2 | From: Christopher Larson <chris_larson@mentor.com> | ||
3 | Date: Tue, 13 Dec 2016 20:39:51 -0700 | ||
4 | Subject: [PATCH] gnome-desktop-thumbnail: don't convert time_t to long | ||
5 | |||
6 | Explicitly use strftime+strptime rather than snprintf+atol. This fixes the | ||
7 | build for X32, where long's size doesn't match that of time_t. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | Signed-off-by: Christopher Larson <chris_larson@mentor.com> | ||
11 | --- | ||
12 | libgnome-desktop/gnome-desktop-thumbnail.c | 16 ++++++++++++++-- | ||
13 | 1 file changed, 14 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c | ||
16 | index 3946309..b756333 100644 | ||
17 | --- a/libgnome-desktop/gnome-desktop-thumbnail.c | ||
18 | +++ b/libgnome-desktop/gnome-desktop-thumbnail.c | ||
19 | @@ -126,6 +126,8 @@ | ||
20 | * Since: 2.2 | ||
21 | */ | ||
22 | |||
23 | +#define _XOPEN_SOURCE | ||
24 | + | ||
25 | #include <config.h> | ||
26 | #include <sys/types.h> | ||
27 | #include <sys/stat.h> | ||
28 | @@ -1483,6 +1485,7 @@ save_thumbnail (GdkPixbuf *pixbuf, | ||
29 | char *tmp_path = NULL; | ||
30 | int tmp_fd; | ||
31 | char mtime_str[21]; | ||
32 | + struct tm *tmp_mtime = NULL; | ||
33 | gboolean ret = FALSE; | ||
34 | GError *error = NULL; | ||
35 | const char *width, *height; | ||
36 | @@ -1502,7 +1505,11 @@ save_thumbnail (GdkPixbuf *pixbuf, | ||
37 | goto out; | ||
38 | close (tmp_fd); | ||
39 | |||
40 | - g_snprintf (mtime_str, 21, "%ld", mtime); | ||
41 | + tmp_mtime = localtime (&mtime); | ||
42 | + if (!tmp_mtime) | ||
43 | + goto out; | ||
44 | + strftime (mtime_str, 21, "%s", tmp_mtime); | ||
45 | + free (tmp_mtime); | ||
46 | width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width"); | ||
47 | height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height"); | ||
48 | |||
49 | @@ -1695,6 +1702,7 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, | ||
50 | { | ||
51 | const char *thumb_uri, *thumb_mtime_str; | ||
52 | time_t thumb_mtime; | ||
53 | + struct tm tmp_mtime; | ||
54 | |||
55 | thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI"); | ||
56 | if (!thumb_uri) | ||
57 | @@ -1705,7 +1713,11 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, | ||
58 | thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime"); | ||
59 | if (!thumb_mtime_str) | ||
60 | return FALSE; | ||
61 | - thumb_mtime = atol (thumb_mtime_str); | ||
62 | + if (!strptime (thumb_mtime_str, "%s", &tmp_mtime)) | ||
63 | + return FALSE; | ||
64 | + thumb_mtime = mktime (&tmp_mtime); | ||
65 | + if (!thumb_mtime) | ||
66 | + return FALSE; | ||
67 | if (mtime != thumb_mtime) | ||
68 | return FALSE; | ||
69 | |||
70 | -- | ||
71 | 2.8.0 | ||
72 | |||
diff --git a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb index e4e9d2fd21..e72c6ce42d 100644 --- a/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb +++ b/meta/recipes-gnome/gnome-desktop/gnome-desktop3_3.22.2.bb | |||
@@ -10,6 +10,8 @@ inherit gnome pkgconfig upstream-version-is-even gobject-introspection | |||
10 | SRC_URI[archive.md5sum] = "3d7222d5305f3db022eca31d8108e02d" | 10 | SRC_URI[archive.md5sum] = "3d7222d5305f3db022eca31d8108e02d" |
11 | SRC_URI[archive.sha256sum] = "51d7ebf7a6c359be14c3dd7a022213e931484653815eb10b0131bef4c8979e1c" | 11 | SRC_URI[archive.sha256sum] = "51d7ebf7a6c359be14c3dd7a022213e931484653815eb10b0131bef4c8979e1c" |
12 | 12 | ||
13 | SRC_URI += "file://gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch" | ||
14 | |||
13 | DEPENDS += "intltool-native gnome-common-native gsettings-desktop-schemas gconf virtual/libx11 gtk+3 glib-2.0 startup-notification xkeyboard-config iso-codes udev" | 15 | DEPENDS += "intltool-native gnome-common-native gsettings-desktop-schemas gconf virtual/libx11 gtk+3 glib-2.0 startup-notification xkeyboard-config iso-codes udev" |
14 | 16 | ||
15 | inherit distro_features_check gtk-doc | 17 | inherit distro_features_check gtk-doc |