gnome-desktop: do not assume time_t is long

Replace use of atol() to set a time_t variable.

(From OE-Core rev: 022866aa0ea6d7a8963d05bb10881e8d97bdf442)

Signed-off-by: Joe Slater <joe.slater@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joe Slater 2018-03-15 09:03:31 -07:00 committed by Richard Purdie
parent 38e0189fae
commit 649d23696f
2 changed files with 10 additions and 22 deletions

View File

@ -9,6 +9,15 @@ build for X32, where long's size doesn't match that of time_t.
Upstream-Status: Pending
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Modify patch described above to eliminate replacement of
g_snprintf (mtime_str, 21, "%" G_GINT64_FORMAT, (gint64) mtime)
which is not necessary. Retain replacement of atol().
Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
libgnome-desktop/gnome-desktop-thumbnail.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
@ -26,27 +35,6 @@ index e56c3d7..5d96bf3 100644
#include <config.h>
#include <glib.h>
@@ -1105,6 +1107,7 @@ save_thumbnail (GdkPixbuf *pixbuf,
char *tmp_path = NULL;
int tmp_fd;
char mtime_str[21];
+ struct tm *tmp_mtime = NULL;
gboolean ret = FALSE;
GError *error = NULL;
const char *width, *height;
@@ -1124,7 +1127,11 @@ save_thumbnail (GdkPixbuf *pixbuf,
goto out;
close (tmp_fd);
- g_snprintf (mtime_str, 21, "%" G_GINT64_FORMAT, (gint64) mtime);
+ tmp_mtime = localtime (&mtime);
+ if (!tmp_mtime)
+ goto out;
+ strftime (mtime_str, 21, "%s", tmp_mtime);
+ free (tmp_mtime);
width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width");
height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height");
@@ -1319,6 +1326,7 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf,
{
const char *thumb_uri, *thumb_mtime_str;

View File

@ -11,7 +11,7 @@ SRC_URI[archive.md5sum] = "6cee2ecd677d87eaa0eb5ebfa7b45fb3"
SRC_URI[archive.sha256sum] = "f7561a7a313fc474b2c390cd9696df1f5c1e1556080e43f4afe042b1060e5f2a"
SRC_URI += " \
file://gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch \
file://gnome-desktop-thumbnail-don-t-assume-time_t-is-long.patch \
file://0001-configure.ac-Remove-gnome-common-macro-calls.patch \
file://0001-Disable-libseccomp-sycall-filtering-mechanism.patch \
"