diff --git a/libgcrypt-1.5.0-etc_gcrypt_rngseed-symlink.diff b/libgcrypt-1.5.0-etc_gcrypt_rngseed-symlink.diff index 6c82006..6e1a05e 100644 --- a/libgcrypt-1.5.0-etc_gcrypt_rngseed-symlink.diff +++ b/libgcrypt-1.5.0-etc_gcrypt_rngseed-symlink.diff @@ -10,10 +10,10 @@ References: bnc#724841 https://bugzilla.novell.com/show_bug.cgi?id=724841 --- - random/random-csprng.c | 2 +- - random/random-fips.c | 10 +++++----- - random/rndlinux.c | 48 ++++++++++++++++++++++++++++++++++++++++++------ - 3 files changed, 48 insertions(+), 12 deletions(-) + random/random-csprng.c | 2 - + random/random-fips.c | 10 ++++---- + random/rndlinux.c | 58 ++++++++++++++++++++++++++++++++++++++++--------- + 3 files changed, 54 insertions(+), 16 deletions(-) Index: libgcrypt-1.6.0/random/random-csprng.c =================================================================== @@ -79,21 +79,37 @@ Index: libgcrypt-1.6.0/random/rndlinux.c { int fd; -@@ -77,8 +78,11 @@ open_device (const char *name, int retry +@@ -67,8 +68,9 @@ open_device (const char *name, int retry + _gcry_random_progress ("open_dev_random", 'X', 1, 0); + again: + fd = open (name, O_RDONLY); +- if (fd == -1 && retry) +- { ++ if (fd == -1) { ++ if (retry) ++ { + struct timeval tv; + + tv.tv_sec = 5; +@@ -76,9 +78,14 @@ open_device (const char *name, int retry + _gcry_random_progress ("wait_dev_random", 'X', 0, (int)tv.tv_sec); select (0, NULL, NULL, NULL, &tv); goto again; - } +- } - if (fd == -1) - log_fatal ("can't open %s: %s\n", name, strerror(errno) ); -+ { -+ if (fatal) ++ } ++ else ++ { ++ if (fatal) + log_fatal ("can't open %s: %s\n", name, strerror(errno) ); -+ return fd; ++ return fd; ++ } + } if (set_cloexec_flag (fd)) log_error ("error setting FD_CLOEXEC on fd %d: %s\n", -@@ -111,11 +115,13 @@ _gcry_rndlinux_gather_random (void (*add +@@ -111,11 +118,13 @@ _gcry_rndlinux_gather_random (void (*add { static int fd_urandom = -1; static int fd_random = -1; @@ -107,7 +123,7 @@ Index: libgcrypt-1.6.0/random/rndlinux.c size_t want = length; size_t last_so_far = 0; int any_need_entropy = 0; -@@ -153,20 +159,46 @@ _gcry_rndlinux_gather_random (void (*add +@@ -153,20 +162,46 @@ _gcry_rndlinux_gather_random (void (*add that we always require the device to be existent but want a more graceful behaviour if the rarely needed close operation has been used and the device needs to be re-opened later. */ @@ -157,7 +173,7 @@ Index: libgcrypt-1.6.0/random/rndlinux.c ever_opened |= 2; } fd = fd_urandom; -@@ -242,6 +274,9 @@ _gcry_rndlinux_gather_random (void (*add +@@ -242,6 +277,9 @@ _gcry_rndlinux_gather_random (void (*add } memset(buffer, 0, sizeof(buffer) ); diff --git a/libgcrypt.changes b/libgcrypt.changes index 610a785..891a8bd 100644 --- a/libgcrypt.changes +++ b/libgcrypt.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jan 3 09:43:39 UTC 2014 - mvyskocil@suse.com + +- fix bnc#856915: can't open /dev/urandom + * correct libgcrypt-1.5.0-etc_gcrypt_rngseed-symlink.diff + ------------------------------------------------------------------- Thu Dec 19 13:53:21 UTC 2013 - mvyskocil@suse.com diff --git a/libgcrypt.spec b/libgcrypt.spec index da7fe16..b3bafb8 100644 --- a/libgcrypt.spec +++ b/libgcrypt.spec @@ -1,7 +1,7 @@ # # spec file for package libgcrypt # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed