aboutsummaryrefslogtreecommitdiffstats
path: root/main/kbd/0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/kbd/0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch')
-rw-r--r--main/kbd/0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/main/kbd/0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch b/main/kbd/0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch
new file mode 100644
index 0000000000..f3e8628af0
--- /dev/null
+++ b/main/kbd/0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch
@@ -0,0 +1,68 @@
+From 7e27102b6fc6991a6a4eca422b513781a26b1639 Mon Sep 17 00:00:00 2001
+From: Alexey Gladkov <gladkov.alexey@gmail.com>
+Date: Wed, 21 Aug 2019 13:29:16 +0200
+Subject: [PATCH] libkbdfile: Check compression suffix even if the suffix is
+ part of filename
+
+Link: https://github.com/legionus/kbd/issues/32
+
+Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
+---
+ src/libkbdfile/kbdfile.c | 25 ++++++++++++-------------
+ src/libkbdfile/kbdfile.h | 2 ++
+ 2 files changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/src/libkbdfile/kbdfile.c b/src/libkbdfile/kbdfile.c
+index fb8e035..487b434 100644
+--- a/src/libkbdfile/kbdfile.c
++++ b/src/libkbdfile/kbdfile.c
+@@ -344,20 +344,13 @@ StartScan:
+ snprintf(fp->pathname, sizeof(fp->pathname), "%s/%s%s%s", dir, fnam, suf[index], (dc ? dc->ext : ""));
+
+ if (!dc) {
+- fp->flags &= ~KBDFILE_PIPE;
+- fp->fd = fopen(fp->pathname, "r");
++ rc = maybe_pipe_open(fp);
++ goto EndScan;
++ }
+
+- if (!(fp->fd)) {
+- strerror_r(errno, errbuf, sizeof(errbuf));
+- ERR(fp->ctx, "fopen: %s: %s", fp->pathname, errbuf);
+- rc = -1;
+- goto EndScan;
+- }
+- } else {
+- if (pipe_open(dc, fp) < 0) {
+- rc = -1;
+- goto EndScan;
+- }
++ if (pipe_open(dc, fp) < 0) {
++ rc = -1;
++ goto EndScan;
+ }
+ }
+
+@@ -457,3 +450,9 @@ kbdfile_open(struct kbdfile_ctx *ctx, const char *filename)
+
+ return fp;
+ }
++
++int
++kbdfile_is_compressed(struct kbdfile *fp)
++{
++ return (fp->flags & KBDFILE_PIPE);
++}
+diff --git a/src/libkbdfile/kbdfile.h b/src/libkbdfile/kbdfile.h
+index 412179a..0318a8e 100644
+--- a/src/libkbdfile/kbdfile.h
++++ b/src/libkbdfile/kbdfile.h
+@@ -45,6 +45,8 @@ int kbdfile_set_pathname(struct kbdfile *fp, const char *pathname);
+ FILE *kbdfile_get_file(struct kbdfile *fp);
+ int kbdfile_set_file(struct kbdfile *fp, FILE *x);
+
++int kbdfile_is_compressed(struct kbdfile *fp);
++
+ #include <syslog.h>
+
+ void