only call ioctl on /dev/random if open succeeded
authorKen Raeburn <raeburn@mit.edu>
Sat, 3 Mar 2001 22:05:29 +0000 (22:05 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 3 Mar 2001 22:05:29 +0000 (22:05 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13051 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/init_os_ctx.c

index f72d643f108f86f3cbd124e4155002ef11aae949..076c16ae4fd71b2985aa8fba5ba5d9aa52d1418e 100644 (file)
@@ -466,7 +466,9 @@ krb5_os_init_context(ctx)
                if (tmp == -1) {
                        int dontblock = 1;
                        tmp = open ("/dev/random", O_RDONLY);
-                       (void) ioctl (tmp, FIONBIO, (char *) &dontblock);
+                       if (tmp != -1)
+                               (void) ioctl (tmp, FIONBIO,
+                                             (char *) &dontblock);
                }
                if (tmp != -1) {
                        /* If this doesn't work, should we continue or