Mercurial > dropbear
comparison random.c @ 70:b0316ce64e4b
Merging in the changes from 0.41-0.43 main Dropbear tree
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 12 Aug 2004 16:41:58 +0000 |
parents | fe6bca95afa7 |
children | ed9ca2a9705c |
comparison
equal
deleted
inserted
replaced
69:59d16db56e9f | 70:b0316ce64e4b |
---|---|
58 char egdcmd[2]; | 58 char egdcmd[2]; |
59 #endif | 59 #endif |
60 | 60 |
61 #ifdef DROPBEAR_DEV_URANDOM | 61 #ifdef DROPBEAR_DEV_URANDOM |
62 readfd = open(DEV_URANDOM, O_RDONLY); | 62 readfd = open(DEV_URANDOM, O_RDONLY); |
63 if (!readfd) { | 63 if (readfd < 0) { |
64 dropbear_exit("couldn't open random device"); | 64 dropbear_exit("couldn't open random device"); |
65 } | 65 } |
66 #endif | 66 #endif |
67 | 67 |
68 #ifdef DROPBEAR_EGD | 68 #ifdef DROPBEAR_EGD |
69 memset((void*)&egdsock, 0x0, sizeof(egdsock)); | 69 memset((void*)&egdsock, 0x0, sizeof(egdsock)); |
70 egdsock.sun_family = AF_UNIX; | 70 egdsock.sun_family = AF_UNIX; |
71 strlcpy(egdsock.sun_path, DROPBEAR_EGD_SOCKET, | 71 strlcpy(egdsock.sun_path, DROPBEAR_EGD_SOCKET, |
72 sizeof(egdsock.sun_path)); | 72 sizeof(egdsock.sun_path)); |
73 | 73 |
74 if ((readfd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { | 74 readfd = socket(PF_UNIX, SOCK_STREAM, 0); |
75 if (readfd < 0) { | |
75 dropbear_exit("couldn't open random device"); | 76 dropbear_exit("couldn't open random device"); |
76 } | 77 } |
77 /* todo - try various common locations */ | 78 /* todo - try various common locations */ |
78 if (connect(readfd, (struct sockaddr*)&egdsock, | 79 if (connect(readfd, (struct sockaddr*)&egdsock, |
79 sizeof(struct sockaddr_un)) < 0) { | 80 sizeof(struct sockaddr_un)) < 0) { |