summaryrefslogtreecommitdiff
path: root/extra/colord/fix-compilation.patch
blob: b956cb9f628528100cbbbc3e09da4d84a29ca552 (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
From 638a98fef16fa15946522d4112660b4b20c0d630 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Thu, 23 Feb 2012 10:43:37 +0000
Subject: [PATCH] trivial: Fix compile with older versions of GLib

g_mapped_file_new_from_fd() was introduced in 2.31.0 not 2.30.0 as the
docs suggested.

Resoves https://bugs.freedesktop.org/show_bug.cgi?id=46481
---
 src/cd-profile.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/cd-profile.c b/src/cd-profile.c
index a292616..323588b 100644
--- a/src/cd-profile.c
+++ b/src/cd-profile.c
@@ -1066,7 +1066,17 @@ cd_profile_set_fd (CdProfile *profile,
 	}
 
 	/* create a mapped file */
+#if GLIB_CHECK_VERSION(2,31,0)
 	priv->mapped_file = g_mapped_file_new_from_fd (fd, FALSE, error);
+	if (priv->mapped_file == NULL) {
+		g_set_error (error,
+			     CD_MAIN_ERROR,
+			     CD_MAIN_ERROR_FAILED,
+			     "failed to create mapped file from fd %i",
+			     fd);
+		goto out;
+	}
+#endif
 
 	/* parse the ICC file */
 	lcms_profile = cmsOpenProfileFromStream (stream, "r");
-- 
1.7.6