about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/X11
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-08-22 13:47:37 +0000
committerAlyssa Ross <hi@alyssa.is>2019-08-22 18:22:22 +0000
commit1b9a13c4689af7e088eb7af5589f8c811282846a (patch)
tree3ed032953008280fb94ef894c869ff3e2a2f7865 /nixpkgs/pkgs/tools/X11
parent4999a38db7c5de0ea9f514a12ecd4133cce647f3 (diff)
parent1412af4b2cfae71d447164097d960d426e9752c0 (diff)
downloadnixlib-1b9a13c4689af7e088eb7af5589f8c811282846a.tar
nixlib-1b9a13c4689af7e088eb7af5589f8c811282846a.tar.gz
nixlib-1b9a13c4689af7e088eb7af5589f8c811282846a.tar.bz2
nixlib-1b9a13c4689af7e088eb7af5589f8c811282846a.tar.lz
nixlib-1b9a13c4689af7e088eb7af5589f8c811282846a.tar.xz
nixlib-1b9a13c4689af7e088eb7af5589f8c811282846a.tar.zst
nixlib-1b9a13c4689af7e088eb7af5589f8c811282846a.zip
Merge remote-tracking branch 'channels/nixos-unstable'
Diffstat (limited to 'nixpkgs/pkgs/tools/X11')
-rw-r--r--nixpkgs/pkgs/tools/X11/ckbcomp/default.nix4
-rw-r--r--nixpkgs/pkgs/tools/X11/xkbvalidate/default.nix6
-rw-r--r--nixpkgs/pkgs/tools/X11/xkbvalidate/xkbvalidate.c21
3 files changed, 23 insertions, 8 deletions
diff --git a/nixpkgs/pkgs/tools/X11/ckbcomp/default.nix b/nixpkgs/pkgs/tools/X11/ckbcomp/default.nix
index 1b6c540b3d88..173963135f87 100644
--- a/nixpkgs/pkgs/tools/X11/ckbcomp/default.nix
+++ b/nixpkgs/pkgs/tools/X11/ckbcomp/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   name = "ckbcomp-${version}";
-  version = "1.192";
+  version = "1.193";
 
   src = fetchFromGitLab {
     domain = "salsa.debian.org";
     owner = "installer-team";
     repo = "console-setup";
     rev = version;
-    sha256 = "1s570y8qwwy71ag9wgpznrhakps6rmw6j7p05hibns1spn2mxd5x";
+    sha256 = "107nl6vpy4036km3gr9z5f3mq1i6x169v0z0a0ywavj3zjqy23rp";
   };
 
   buildInputs = [ perl ];
diff --git a/nixpkgs/pkgs/tools/X11/xkbvalidate/default.nix b/nixpkgs/pkgs/tools/X11/xkbvalidate/default.nix
index f5a264108359..92a47aa65638 100644
--- a/nixpkgs/pkgs/tools/X11/xkbvalidate/default.nix
+++ b/nixpkgs/pkgs/tools/X11/xkbvalidate/default.nix
@@ -5,11 +5,11 @@ runCommandCC "xkbvalidate" {
   meta = {
     description = "NixOS tool to validate X keyboard configuration";
     license = lib.licenses.mit;
-    platforms = lib.platforms.linux;
+    platforms = lib.platforms.unix;
     maintainers = [ lib.maintainers.aszlig ];
   };
 } ''
   mkdir -p "$out/bin"
-  gcc -std=gnu11 -Wall -pedantic -lxkbcommon ${./xkbvalidate.c} \
-    -o "$out/bin/validate"
+  $CC -std=c11 -Wall -pedantic -lxkbcommon ${./xkbvalidate.c} \
+    -o "$out/bin/xkbvalidate"
 ''
diff --git a/nixpkgs/pkgs/tools/X11/xkbvalidate/xkbvalidate.c b/nixpkgs/pkgs/tools/X11/xkbvalidate/xkbvalidate.c
index d9c9042467c0..d25eef154b3c 100644
--- a/nixpkgs/pkgs/tools/X11/xkbvalidate/xkbvalidate.c
+++ b/nixpkgs/pkgs/tools/X11/xkbvalidate/xkbvalidate.c
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -14,6 +13,9 @@ static bool log_alloc_success = true;
 static void add_log(struct xkb_context *ctx, enum xkb_log_level level,
                     const char *fmt, va_list args)
 {
+    size_t buflen;
+    va_list tmpargs;
+
     log_buffer_size++;
 
     if (log_buffer == NULL)
@@ -28,11 +30,24 @@ static void add_log(struct xkb_context *ctx, enum xkb_log_level level,
         return;
     }
 
-    if (vasprintf(&log_buffer[log_buffer_size - 1], fmt, args) == -1) {
+    /* Unfortunately, vasprintf() is a GNU extension and thus not very
+     * portable, so let's first get the required buffer size using a dummy
+     * vsnprintf and afterwards allocate the returned amount of bytes.
+     *
+     * We also need to make a copy of the args, because the value of the args
+     * will be indeterminate after the return.
+     */
+    va_copy(tmpargs, args);
+    buflen = vsnprintf(NULL, 0, fmt, tmpargs);
+    va_end(tmpargs);
+
+    log_buffer[log_buffer_size - 1] = malloc(++buflen);
+
+    if (vsnprintf(log_buffer[log_buffer_size - 1], buflen, fmt, args) == -1) {
         perror("log line alloc");
         log_alloc_success = false;
-        return;
     }
+    va_end(args);
 }
 
 static void print_logs(void)