[Pkg-running-devel] [antpm] 24/39: gant: fix two bugs

Kristof Ralovich ralovich-guest at moszumanska.debian.org
Fri Nov 7 11:13:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

ralovich-guest pushed a commit to branch upstream
in repository antpm.

commit 55ccd71f73276006712f9247284aa825b49a0281
Author: RALOVICH, Kristof <tade60 at freemail.hu>
Date:   Mon Aug 11 18:37:30 2014 +0200

    gant: fix two bugs
    
    reported by coverity:
    - uninitialized r
    - leaking fd
---
 src/gant/gant.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gant/gant.c b/src/gant/gant.c
index 044f80c..73b04cb 100644
--- a/src/gant/gant.c
+++ b/src/gant/gant.c
@@ -194,11 +194,13 @@ uint randno(void)
   uint r;
   int fd = open("/dev/urandom", O_RDONLY);
 
-  if (fd > 0)
+  if (fd >= 0)
   {
     read(fd, &r, sizeof r);
     close(fd);
   }
+  else
+    r = rand();
   return r;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/antpm.git



More information about the Pkg-running-devel mailing list