[xdg-desktop-portal-gnome/gnome-42] main: Don't assume that environment variables were successfully set



commit 35b280080ba13de0dad12e13c28c3134ee22326b
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Jul 2 17:13:17 2022 +0200

    main: Don't assume that environment variables were successfully set
    
    Fallout from ab21bc9d9887f90110b843cda3ff73bfc11f0df9 and
    7f6357032d0f7b936242f05b13dab59807a44ebc
    
    https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/46

 src/xdg-desktop-portal-gnome.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/xdg-desktop-portal-gnome.c b/src/xdg-desktop-portal-gnome.c
index d4f1c0a..b3139a7 100644
--- a/src/xdg-desktop-portal-gnome.c
+++ b/src/xdg-desktop-portal-gnome.c
@@ -204,8 +204,18 @@ main (int argc, char *argv[])
 
   /* Avoid pointless and confusing recursion */
   g_unsetenv ("GTK_USE_PORTAL");
-  g_setenv ("ADW_DISABLE_PORTAL", "1", TRUE);
-  g_setenv ("GSK_RENDERER", "cairo", TRUE);
+
+  if (G_UNLIKELY (!g_setenv ("ADW_DISABLE_PORTAL", "1", TRUE)))
+    {
+      g_printerr ("Failed to set ADW_DISABLE_PORTAL: %s\n", g_strerror (errno));
+      return 1;
+    }
+
+  if (G_UNLIKELY (!g_setenv ("GSK_RENDERER", "cairo", TRUE)))
+    {
+      g_printerr ("Failed to set GSK_RENDERER: %s\n", g_strerror (errno));
+      return 1;
+    }
 
   gtk_init ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]