[X2Go-Dev] Bug#516: Bug#516: [PATCH 3/5] Error reporting logic in keyboard section.

Mihai Moldovan ionic at ionic.de
Sat Jun 21 05:23:40 CEST 2014


Don't print out nonsensical information, if there really was no error when
creating the keyboard file or the other way around.

Also add the reason when failing to create the keyboard file.

Lastly, only print an error message if SessionPath *really* is not defined.
-------------- next part --------------
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index dfafe1e..3826d80 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -73,6 +73,8 @@ is" without express or implied warranty.
 
 #include "Xatom.h"
 
+#include <errno.h>
+
 static int nxagentXkbGetNames(char **rules, char **model, char **layout,
                                   char **variant, char **options);
 
@@ -1816,11 +1859,17 @@ void nxagentKeycodeConversionSetup(void)
         if ( doptions != NULL )
           fprintf(keyboard_file, "options=%s\n", doptions);
         fclose(keyboard_file);
+        fprintf(stderr, "keyboard file created\n");
+      }
+      else {
+        int save_err = errno;
+        fprintf(stderr, "keyboard file not created: %s\n", strerror(save_err));
       }
       free(keyboard_file_path);
-      fprintf(stderr, "keyboard file created\n");
     }
-    fprintf(stderr, "SessionPath not defined\n");
+    else {
+      fprintf(stderr, "SessionPath not defined\n");
+    }
   }
   else
   {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4265 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.x2go.org/pipermail/x2go-dev/attachments/20140621/00dac854/attachment.bin>


More information about the x2go-dev mailing list