summary refs log tree commit diff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/feh-fix-tests-for-imlib2-1.6.patch51
-rw-r--r--gnu/packages/patches/libseccomp-open-aarch64.patch27
-rw-r--r--gnu/packages/patches/pam-mount-luks2-support.patch51
-rw-r--r--gnu/packages/patches/xsane-fix-memory-leak.patch34
-rw-r--r--gnu/packages/patches/xsane-fix-pdf-floats.patch85
-rw-r--r--gnu/packages/patches/xsane-fix-snprintf-buffer-length.patch72
-rw-r--r--gnu/packages/patches/xsane-support-ipv6.patch153
-rw-r--r--gnu/packages/patches/xsane-tighten-default-umask.patch36
8 files changed, 509 insertions, 0 deletions
diff --git a/gnu/packages/patches/feh-fix-tests-for-imlib2-1.6.patch b/gnu/packages/patches/feh-fix-tests-for-imlib2-1.6.patch
new file mode 100644
index 0000000000..a91906dbe9
--- /dev/null
+++ b/gnu/packages/patches/feh-fix-tests-for-imlib2-1.6.patch
@@ -0,0 +1,51 @@
+commit 8048fb542d0c36f868760ba1590fbe14a3a85df7
+Author: Pierre Langlois <pierre.langlois@gmx.com>
+Date:   Wed Nov 27 10:42:05 2019 +0000
+
+    Adapt tests for imlib2 1.6
+    
+    Reported upstream on https://github.com/derf/feh/issues/497
+
+diff --git a/test/list/custom b/test/list/custom
+index dbe2074..40ac557 100644
+--- a/test/list/custom
++++ b/test/list/custom
+@@ -1,4 +1,4 @@
+ test/ok/gif; 16; 4; list; gif; 256; 953; gif; 1; 16
+-test/ok/jpg; 16; 4; list; jpg; 256; 354; jpeg; 2; 16
++test/ok/jpg; 16; 4; list; jpg; 256; 354; jpg; 2; 16
+ test/ok/png; 16; 4; list; png; 256; 403; png; 3; 16
+ test/ok/pnm; 16; 4; list; pnm; 256; 269; pnm; 4; 16
+diff --git a/test/list/default b/test/list/default
+index bc0ef52..e480db3 100644
+--- a/test/list/default
++++ b/test/list/default
+@@ -1,5 +1,5 @@
+ NUM	FORMAT	WIDTH	HEIGHT	PIXELS	SIZE	ALPHA	FILENAME
+ 1	gif	16	16	256 	953 	-	test/ok/gif
+-2	jpeg	16	16	256 	354 	-	test/ok/jpg
++2	jpg	16	16	256 	354 	-	test/ok/jpg
+ 3	png	16	16	256 	403 	X	test/ok/png
+ 4	pnm	16	16	256 	269 	-	test/ok/pnm
+diff --git a/test/list/format_reverse b/test/list/format_reverse
+index 9216184..3301f78 100644
+--- a/test/list/format_reverse
++++ b/test/list/format_reverse
+@@ -1,5 +1,5 @@
+ NUM	FORMAT	WIDTH	HEIGHT	PIXELS	SIZE	ALPHA	FILENAME
+ 1	pnm	16	16	256 	269 	-	test/ok/pnm
+ 2	png	16	16	256 	403 	X	test/ok/png
+-3	jpeg	16	16	256 	354 	-	test/ok/jpg
++3	jpg	16	16	256 	354 	-	test/ok/jpg
+ 4	gif	16	16	256 	953 	-	test/ok/gif
+diff --git a/test/list/size b/test/list/size
+index cad60b0..7716239 100644
+--- a/test/list/size
++++ b/test/list/size
+@@ -1,5 +1,5 @@
+ NUM	FORMAT	WIDTH	HEIGHT	PIXELS	SIZE	ALPHA	FILENAME
+ 1	pnm	16	16	256 	269 	-	test/ok/pnm
+-2	jpeg	16	16	256 	354 	-	test/ok/jpg
++2	jpg	16	16	256 	354 	-	test/ok/jpg
+ 3	png	16	16	256 	403 	X	test/ok/png
+ 4	gif	16	16	256 	953 	-	test/ok/gif
diff --git a/gnu/packages/patches/libseccomp-open-aarch64.patch b/gnu/packages/patches/libseccomp-open-aarch64.patch
new file mode 100644
index 0000000000..6e62825892
--- /dev/null
+++ b/gnu/packages/patches/libseccomp-open-aarch64.patch
@@ -0,0 +1,27 @@
+This patch fixes the build failure on AArch64 reported
+at <https://github.com/seccomp/libseccomp/pull/191>.
+
+From cc21c1b48d35f9d34ef2da0e184af3855bfeee5f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
+Date: Wed, 20 Nov 2019 14:11:12 -0500
+Subject: [PATCH] tests: use openat instead of open
+
+On arm64, __NR_open is not defined, openat is always used. Let's use openat
+instead, which is defined for architectures currently.
+---
+ tests/15-basic-resolver.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/15-basic-resolver.c b/tests/15-basic-resolver.c
+index 6badef1..4884faf 100644
+--- a/tests/15-basic-resolver.c
++++ b/tests/15-basic-resolver.c
+@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
+ 	unsigned int arch;
+ 	char *name = NULL;
+ 
+-	if (seccomp_syscall_resolve_name("open") != __NR_open)
++	if (seccomp_syscall_resolve_name("openat") != __NR_openat)
+ 		goto fail;
+ 	if (seccomp_syscall_resolve_name("read") != __NR_read)
+ 		goto fail;
diff --git a/gnu/packages/patches/pam-mount-luks2-support.patch b/gnu/packages/patches/pam-mount-luks2-support.patch
new file mode 100644
index 0000000000..b59daf5ce1
--- /dev/null
+++ b/gnu/packages/patches/pam-mount-luks2-support.patch
@@ -0,0 +1,51 @@
+From d4434c05e7c0cf05d87089404cfa2deedc60811a Mon Sep 17 00:00:00 2001
+From: Ingo Franzki <ifranzki@linux.ibm.com>
+Date: Mon, 29 Oct 2018 16:47:40 +0100
+Subject: [PATCH] crypto: Add support for LUKS2
+
+Cryptsetup version 2.0 added support for LUKS2.
+This patch adds support for mounting LUKS2 volumes with
+pam_mount.
+
+Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
+---
+ src/crypto-dmc.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/crypto-dmc.c b/src/crypto-dmc.c
+index d0ab6ca..abd0358 100644
+--- a/src/crypto-dmc.c
++++ b/src/crypto-dmc.c
+@@ -21,6 +21,12 @@
+ #include "libcryptmount.h"
+ #include "pam_mount.h"
+ 
++#ifndef CRYPT_LUKS
++	#define CRYPT_LUKS	NULL /* Passing NULL to crypt_load will
++					default to LUKS(1) on older
++					libcryptsetup versions. */
++#endif
++
+ /**
+  * dmc_is_luks - check if @path points to a LUKS volume (cf. normal dm-crypt)
+  * @path:	path to the crypto container
+@@ -48,7 +54,7 @@ EXPORT_SYMBOL int ehd_is_luks(const char *path, bool blkdev)
+ 
+ 	ret = crypt_init(&cd, device);
+ 	if (ret == 0) {
+-		ret = crypt_load(cd, CRYPT_LUKS1, NULL);
++		ret = crypt_load(cd, CRYPT_LUKS, NULL);
+ 		if (ret == -EINVAL)
+ 			ret = false;
+ 		else if (ret == 0)
+@@ -106,7 +112,7 @@ static bool dmc_run(const struct ehd_mount_request *req,
+ #endif
+ 	}
+ 
+-	ret = crypt_load(cd, CRYPT_LUKS1, NULL);
++	ret = crypt_load(cd, CRYPT_LUKS, NULL);
+ 	if (ret == 0) {
+ 		ret = crypt_activate_by_passphrase(cd, mt->crypto_name,
+ 		      CRYPT_ANY_SLOT, req->key_data, req->key_size, flags);
+-- 
+2.21.0
diff --git a/gnu/packages/patches/xsane-fix-memory-leak.patch b/gnu/packages/patches/xsane-fix-memory-leak.patch
new file mode 100644
index 0000000000..4e03e57e13
--- /dev/null
+++ b/gnu/packages/patches/xsane-fix-memory-leak.patch
@@ -0,0 +1,34 @@
+From bbd54510f0297afa2d1a81927db060cb0b791f14 Mon Sep 17 00:00:00 2001
+From: Ralph Little <littlesincanada@yahoo.co.uk>
+Date: Sun, 1 Sep 2019 17:34:19 -0700
+Subject: [PATCH] Apply opensuse upstream patch xsane_memory_leak
+
+Removes completely redundant memory allocation.
+---
+ src/xsane-batch-scan.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/src/xsane-batch-scan.c b/src/xsane-batch-scan.c
+index 90cc0e0..e77caca 100644
+--- a/src/xsane-batch-scan.c
++++ b/src/xsane-batch-scan.c
+@@ -680,7 +680,6 @@ static GtkWidget *xsane_batch_scan_create_list_entry(Batch_Scan_Parameters *para
+  GtkWidget *list_item;
+  GtkWidget *hbox;
+  int size = 120;
+- char *data;
+ 
+   list_item = gtk_list_item_new();
+ 
+@@ -688,8 +687,6 @@ static GtkWidget *xsane_batch_scan_create_list_entry(Batch_Scan_Parameters *para
+   gtk_container_add(GTK_CONTAINER(list_item), hbox);
+   gtk_widget_show(hbox);
+ 
+-  data = calloc(size, size);
+-
+   parameters->gtk_preview = gtk_preview_new(GTK_PREVIEW_COLOR);
+   gtk_preview_size(GTK_PREVIEW(parameters->gtk_preview), size, size);
+   gtk_box_pack_start(GTK_BOX(hbox), parameters->gtk_preview, FALSE, FALSE, 0);
+-- 
+2.22.0
+
diff --git a/gnu/packages/patches/xsane-fix-pdf-floats.patch b/gnu/packages/patches/xsane-fix-pdf-floats.patch
new file mode 100644
index 0000000000..5f26fa140b
--- /dev/null
+++ b/gnu/packages/patches/xsane-fix-pdf-floats.patch
@@ -0,0 +1,85 @@
+From c126eea11c4ee39cbe9c0c76f920626b618b6ee9 Mon Sep 17 00:00:00 2001
+From: Ralph Little <littlesincanada@yahoo.co.uk>
+Date: Sun, 1 Sep 2019 17:03:44 -0700
+Subject: [PATCH] Apply debian upstream patch 0135-fix_pdf_floats
+
+Original patch commentary:
+
+Description: Fix floats in PDF and PostScript
+ Set LC_NUMERIC to POSIX before printing floats when building
+ PostScript or PDF output.
+Author: Julien BLACHE <jblache@debian.org>
+Forwarded: yes
+
+------------
+Looks like float printing format is affected by the current locale.
+Ensures that we always get POSIX formatting of floats.
+---
+ src/xsane-save.c | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/src/xsane-save.c b/src/xsane-save.c
+index f14df05..63550cc 100644
+--- a/src/xsane-save.c
++++ b/src/xsane-save.c
+@@ -26,6 +26,8 @@
+ #include "xsane-back-gtk.h"
+ #include "xsane-front-gtk.h"
+ #include "xsane-save.h"
++#include <locale.h>
++#include <string.h>
+ #include <time.h>
+ #include <sys/wait.h> 
+ 
+@@ -2425,6 +2427,7 @@ static void xsane_save_ps_create_image_header(FILE *outfile,
+                                               int flatedecode)
+ {
+  int depth; 
++ char *save_locale;
+ 
+   depth = image_info->depth;
+ 
+@@ -2442,8 +2445,15 @@ static void xsane_save_ps_create_image_header(FILE *outfile,
+ 
+   fprintf(outfile, "%d rotate\n", degree);
+   fprintf(outfile, "%d %d translate\n", position_left, position_bottom);
++
++  save_locale = strdup(setlocale(LC_NUMERIC, NULL));
++  setlocale(LC_NUMERIC, "POSIX");
++
+   fprintf(outfile, "%f %f scale\n", width, height);
+ 
++  setlocale(LC_NUMERIC, save_locale);
++  free(save_locale);
++
+   fprintf(outfile, "<<\n");
+   fprintf(outfile, " /ImageType 1\n");
+   fprintf(outfile, " /Width %d\n", image_info->image_width);
+@@ -3921,6 +3931,7 @@ static void xsane_save_pdf_create_page_header(FILE *outfile, struct pdf_xref *xr
+  int position_left, position_bottom, box_left, box_bottom, box_right, box_top, depth;
+  int left, bottom;
+  float rad;
++ char *save_locale;
+ 
+   DBG(DBG_proc, "xsane_save_pdf_create_page_header\n");
+ 
+@@ -4035,8 +4046,16 @@ static void xsane_save_pdf_create_page_header(FILE *outfile, struct pdf_xref *xr
+ 
+   fprintf(outfile, "q\n");
+   fprintf(outfile, "1 0 0 1 %d %d cm\n", position_left, position_bottom); /* translate */
++
++  save_locale = strdup(setlocale(LC_NUMERIC, NULL));
++  setlocale(LC_NUMERIC, "POSIX");
++
+   fprintf(outfile, "%f %f -%f %f 0 0 cm\n", cos(rad), sin(rad), sin(rad), cos(rad)); /* rotate */
+   fprintf(outfile, "%f 0 0 %f 0 0 cm\n", width, height); /* scale */
++
++  setlocale(LC_NUMERIC, save_locale);
++  free(save_locale);
++
+   fprintf(outfile, "BI\n");
+   fprintf(outfile, "  /W %d\n", image_info->image_width);
+   fprintf(outfile, "  /H %d\n", image_info->image_height);
+-- 
+2.22.0
+
diff --git a/gnu/packages/patches/xsane-fix-snprintf-buffer-length.patch b/gnu/packages/patches/xsane-fix-snprintf-buffer-length.patch
new file mode 100644
index 0000000000..412e127f5a
--- /dev/null
+++ b/gnu/packages/patches/xsane-fix-snprintf-buffer-length.patch
@@ -0,0 +1,72 @@
+From 893a5ce1f75e5eea7c8d383038ff92a150819c9c Mon Sep 17 00:00:00 2001
+From: Ralph Little <littlesincanada@yahoo.co.uk>
+Date: Thu, 19 Sep 2019 22:02:33 -0700
+Subject: [PATCH] xsane-*-project.c - reduced snprintf format pad to silence
+ warning about too long constrant string for buffer.
+
+---
+ src/xsane-email-project.c     | 4 ++--
+ src/xsane-fax-project.c       | 4 ++--
+ src/xsane-multipage-project.c | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/xsane-email-project.c b/src/xsane-email-project.c
+index f20cb12..ac93fc2 100644
+--- a/src/xsane-email-project.c
++++ b/src/xsane-email-project.c
+@@ -896,7 +896,7 @@ static void xsane_email_project_update_project_status()
+   snprintf(filename, sizeof(filename), "%s/xsane-mail-list", preferences.email_project);
+   projectfile = fopen(filename, "r+b"); /* r+ = read and write, position = start of file */
+ 
+-  snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.email_status); /* fill 32 characters status line */
++  snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.email_status); /* fill 32 characters status line */
+   fprintf(projectfile, "%s\n", buf); /* first line is status of email */
+ 
+   fclose(projectfile);
+@@ -936,7 +936,7 @@ void xsane_email_project_save()
+   {
+    char buf[TEXTBUFSIZE];
+ 
+-    snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.email_status); /* fill 32 characters status line */
++    snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.email_status); /* fill 32 characters status line */
+     fprintf(projectfile, "%s\n", buf); /* first line is status of email */
+     gtk_progress_set_format_string(GTK_PROGRESS(xsane.project_progress_bar), _(xsane.email_status));
+     xsane_progress_bar_set_fraction(GTK_PROGRESS_BAR(xsane.project_progress_bar), 0.0);
+diff --git a/src/xsane-fax-project.c b/src/xsane-fax-project.c
+index f263313..0c60a97 100644
+--- a/src/xsane-fax-project.c
++++ b/src/xsane-fax-project.c
+@@ -452,7 +452,7 @@ static void xsane_fax_project_update_project_status()
+   snprintf(filename, sizeof(filename), "%s/xsane-fax-list", preferences.fax_project);
+   projectfile = fopen(filename, "r+b"); /* r+ = read and write, position = start of file */
+ 
+-  snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.fax_status); /* fill 32 characters status line */
++  snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.fax_status); /* fill 32 characters status line */
+   fprintf(projectfile, "%s\n", buf); /* first line is status of mail */
+ 
+   fclose(projectfile);
+@@ -498,7 +498,7 @@ void xsane_fax_project_save()
+   {
+    char buf[TEXTBUFSIZE];
+ 
+-    snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.fax_status); /* fill 32 characters status line */
++    snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.fax_status); /* fill 32 characters status line */
+     fprintf(projectfile, "%s\n", buf); /* first line is status of mail */
+     gtk_progress_set_format_string(GTK_PROGRESS(xsane.project_progress_bar), _(xsane.fax_status));
+     xsane_progress_bar_set_fraction(GTK_PROGRESS_BAR(xsane.project_progress_bar), 0.0);
+diff --git a/src/xsane-multipage-project.c b/src/xsane-multipage-project.c
+index f23e5f8..9392e00 100644
+--- a/src/xsane-multipage-project.c
++++ b/src/xsane-multipage-project.c
+@@ -522,7 +522,7 @@ void xsane_multipage_project_save()
+   {
+    char buf[TEXTBUFSIZE];
+ 
+-    snprintf(buf, 32, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.multipage_status); /* fill 32 characters status line */
++    snprintf(buf, 33, "%s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", xsane.multipage_status); /* fill 32 characters status line */
+     fprintf(projectfile, "%s\n", buf); /* first line is status of multipage */
+     gtk_progress_set_format_string(GTK_PROGRESS(xsane.project_progress_bar), _(xsane.multipage_status));
+     xsane_progress_bar_set_fraction(GTK_PROGRESS_BAR(xsane.project_progress_bar), 0.0);
+-- 
+2.23.0
+
diff --git a/gnu/packages/patches/xsane-support-ipv6.patch b/gnu/packages/patches/xsane-support-ipv6.patch
new file mode 100644
index 0000000000..4e3bb87a1a
--- /dev/null
+++ b/gnu/packages/patches/xsane-support-ipv6.patch
@@ -0,0 +1,153 @@
+From 62d9c172f258769e3a7540fe710e013bb39a704f Mon Sep 17 00:00:00 2001
+From: Ralph Little <littlesincanada@yahoo.co.uk>
+Date: Sat, 7 Sep 2019 12:39:45 -0700
+Subject: [PATCH] Apply opensuse upstream patch 004-ipv6-support
+
+Appears to be related to this:
+https://bugzilla.redhat.com/show_bug.cgi?id=198422
+
+-----
+Changes email socket connection code to use more IP version agnostic
+calls. It appears to only be used by the scan email option and
+originally comes from the RedHat IPv6 awareness program mentioned
+in the bug report.
+
+In practice, I'm not sure how practical the implementation for emailing
+scans in xsane is as it does not look to support encryption, pretty
+much a given in today's world.
+---
+ src/xsane-save.c | 96 +++++++++++++++++++++++++++++++-----------------
+ 1 file changed, 62 insertions(+), 34 deletions(-)
+
+diff --git a/src/xsane-save.c b/src/xsane-save.c
+index 63550cc..ff3c459 100644
+--- a/src/xsane-save.c
++++ b/src/xsane-save.c
+@@ -31,6 +31,8 @@
+ #include <time.h>
+ #include <sys/wait.h> 
+ 
++#include <glib.h>
++
+ /* the following test is always false */
+ #ifdef _native_WIN32
+ # include <winsock.h>
+@@ -7540,55 +7542,81 @@ void write_email_attach_file(int fd_socket, char *boundary, FILE *infile, char *
+ /* returns fd_socket if sucessfull, < 0 when error occured */
+ int open_socket(char *server, int port)
+ {
+- int fd_socket;
+- struct sockaddr_in sin;
+- struct hostent *he;
++ int fd_socket, e;
++
++ struct addrinfo *ai_list, *ai;
++ struct addrinfo hints;
++ gchar *port_s;
++ gint connected;
++
++  memset(&hints, '\0', sizeof(hints));
++  hints.ai_flags = AI_ADDRCONFIG;
++  hints.ai_socktype = SOCK_STREAM;
++
++  port_s = g_strdup_printf("%d", port);
++  e = getaddrinfo(server, port_s, &hints, &ai_list);
++  g_free(port_s);
+ 
+-  he = gethostbyname(server);
+-  if (!he)
++  if (e != 0)
+   {
+-    DBG(DBG_error, "open_socket: Could not get hostname of \"%s\"\n", server);
++    DBG(DBG_error, "open_socket: Could not lookup \"%s\"\n", server);
+    return -1;
+   }
+-  else
++
++  connected = 0;
++  for (ai = ai_list; ai != NULL && !connected; ai = ai->ai_next)
+   {
+-    DBG(DBG_info, "open_socket: connecting to \"%s\" = %d.%d.%d.%d\n",
+-        he->h_name,
+-        (unsigned char) he->h_addr_list[0][0],
+-        (unsigned char) he->h_addr_list[0][1],
+-        (unsigned char) he->h_addr_list[0][2],
+-        (unsigned char) he->h_addr_list[0][3]);
+-  }
++    gchar hostname[NI_MAXHOST];
++    gchar hostaddr[NI_MAXHOST];
++
++    /* If all else fails */
++    strncpy(hostname, "(unknown name)", NI_MAXHOST-1);
++    strncpy(hostaddr, "(unknown address)", NI_MAXHOST-1);
++
++    /* Determine canonical name and IPv4/IPv6 address */
++    (void) getnameinfo(ai->ai_addr, ai->ai_addrlen, hostname, sizeof(hostname),
++                       NULL, 0, 0);
++    (void) getnameinfo(ai->ai_addr, ai->ai_addrlen, hostaddr, sizeof(hostaddr),
++                       NULL, 0, NI_NUMERICHOST);
++
++    DBG(DBG_info, "open_socket: connecting to \"%s\" (\"%s\"): %s\n",
++        server, hostname, hostaddr);
+  
+-  if (he->h_addrtype != AF_INET)
+-  {
+-    DBG(DBG_error, "open_socket: Unknown address family: %d\n", he->h_addrtype);
+-   return -1;
+-  }
++    if ((ai->ai_family != AF_INET) && (ai->ai_family != AF_INET6))
++    {
++      DBG(DBG_error, "open_socket: Unknown address family: %d\n", ai->ai_family);
++      continue;
++    }
+ 
+-  fd_socket = socket(AF_INET, SOCK_STREAM, 0);
++    fd_socket = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ 
+-  if (fd_socket < 0)
+-  {
+-    DBG(DBG_error, "open_socket: Could not create socket: %s\n", strerror(errno));
+-   return -1;
+-  }
++    if (fd_socket < 0)
++    {
++      DBG(DBG_error, "open_socket: Could not create socket: %s\n", strerror(errno));
++      continue;
++    }
+ 
+-/*  setsockopt (dev->ctl, level, TCP_NODELAY, &on, sizeof (on)); */
++    /*  setsockopt (dev->ctl, level, TCP_NODELAY, &on, sizeof (on)); */
+ 
+-  sin.sin_port = htons(port);
+-  sin.sin_family = AF_INET;
+-  memcpy(&sin.sin_addr, he->h_addr_list[0], he->h_length);
++    if (connect(fd_socket, ai->ai_addr, ai->ai_addrlen) != 0)
++    {
++      DBG(DBG_error, "open_socket: Could not connect with port %d of socket: %s\n", port, strerror(errno));
++      continue;
++    }
++
++    /* All went well */
++    connected = 1;
++  }
+ 
+-  if (connect(fd_socket, &sin, sizeof(sin)))
++  if (!connected)
+   {
+-    DBG(DBG_error, "open_socket: Could not connect with port %d of socket: %s\n", ntohs(sin.sin_port), strerror(errno));
+-   return -1;
++    DBG(DBG_info, "open_socket: Could not connect to any address");
++    return -1;
+   }
+ 
+-  DBG(DBG_info, "open_socket: Connected with port %d\n", ntohs(sin.sin_port));
++  DBG(DBG_info, "open_socket: Connected with port %d\n", port);
+ 
+- return fd_socket;
++  return fd_socket;
+ }
+ 
+ /* ---------------------------------------------------------------------------------------------------------------------- */
+-- 
+2.22.0
+
diff --git a/gnu/packages/patches/xsane-tighten-default-umask.patch b/gnu/packages/patches/xsane-tighten-default-umask.patch
new file mode 100644
index 0000000000..5ee5fdfd37
--- /dev/null
+++ b/gnu/packages/patches/xsane-tighten-default-umask.patch
@@ -0,0 +1,36 @@
+From 5dc1e301a165709c60c435f00ec9bb6d7d5f21f3 Mon Sep 17 00:00:00 2001
+From: Ralph Little <littlesincanada@yahoo.co.uk>
+Date: Tue, 27 Aug 2019 21:40:02 -0700
+Subject: [PATCH] Apply debian upstream patch 0160-fix_tighten_default_umask
+
+Original patch commentary:
+
+Description: Change default XSane umask from 0007 to 0077
+ A default umask of 0007 can be mildly insecure in a multiuser environment,
+ so tighten things up a bit and go with 0077 instead.
+Author: Adrien Thebo
+Bug-Debian: http://bugs.debian.org/592972
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xsane/+bug/611950
+
+----
+As above.
+---
+ src/xsane.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/xsane.h b/src/xsane.h
+index 67f06d4..fa04418 100644
+--- a/src/xsane.h
++++ b/src/xsane.h
+@@ -104,7 +104,7 @@
+ #define XSANE_DEBUG_ENVIRONMENT	"XSANE_DEBUG"
+ 
+ #define XSANE_PROGRESS_BAR_MIN_DELTA_PERCENT 0.025
+-#define XSANE_DEFAULT_UMASK		0007
++#define XSANE_DEFAULT_UMASK		0077
+ #define XSANE_HOLD_TIME			200
+ #define XSANE_CONTINUOUS_HOLD_TIME	10
+ #define XSANE_DEFAULT_DEVICE		"SANE_DEFAULT_DEVICE"
+-- 
+2.22.0
+