[gnome-color-manager/gnome-3-10] Make it work with dispcal using stderr
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager/gnome-3-10] Make it work with dispcal using stderr
- Date: Thu, 5 Dec 2013 15:59:06 +0000 (UTC)
commit cdf512e4748ba6279e8e5585ad6fd8296f1baa3e
Author: Patryk Zawadzki <patrys room-303 com>
Date: Thu Dec 5 16:41:41 2013 +0100
Make it work with dispcal using stderr
Signed-off-by: Richard Hughes <richard hughsie com>
src/gcm-calibrate-argyll.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index 52a4b64..52b8eeb 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -160,7 +160,9 @@ gcm_calibrate_argyll_get_display (const gchar *output_name,
{
gboolean ret = FALSE;
gchar *command = NULL;
- gchar *data = NULL;
+ const gchar *data;
+ gchar *data_stderr = NULL;
+ gchar *data_stdout = NULL;
gchar *name;
gchar **split = NULL;
gint exit_status;
@@ -178,15 +180,28 @@ gcm_calibrate_argyll_get_display (const gchar *output_name,
ret = g_spawn_sync (NULL,
(gchar **) argv,
NULL,
- G_SPAWN_STDERR_TO_DEV_NULL,
+ 0,
NULL, NULL,
- &data,
- NULL,
+ &data_stdout,
+ &data_stderr,
&exit_status,
error);
if (!ret)
goto out;
+ /* recent versions of dispcal switched to stderr output */
+ if (data_stdout != NULL && data_stdout[0] != '\0') {
+ data = data_stdout;
+ } else if (data_stderr != NULL && data_stderr[0] != '\0') {
+ data = data_stderr;
+ } else {
+ g_set_error_literal (error,
+ GCM_CALIBRATE_ERROR,
+ GCM_CALIBRATE_ERROR_INTERNAL,
+ "no sensible output from dispcal");
+ goto out;
+ }
+
/* split it into lines */
split = g_strsplit (data, "\n", -1);
for (i=0; split[i] != NULL; i++) {
@@ -216,7 +231,8 @@ gcm_calibrate_argyll_get_display (const gchar *output_name,
}
out:
g_free (command);
- g_free (data);
+ g_free (data_stdout);
+ g_free (data_stderr);
g_strfreev (split);
return display;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]