Skip to content

Commit 95e390e

Browse files
jesse99brson
authored andcommitted
---
yaml --- r: 33823 b: refs/heads/snap-stage3 c: 8adacc0 h: refs/heads/master i: 33821: d74deeb 33819: ae63e4b 33815: 1162270 33807: c162c61 33791: ee7a913 v: v3
1 parent ffad1d2 commit 95e390e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 3ac90ec9f8eb1ad74c73f15268b19e472fc96b76
4+
refs/heads/snap-stage3: 8adacc06aa66e6a84849af8699b8eed8fcbd5764
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/rt/rust_util.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,18 @@ inline void isaac_seed(rust_kernel* kernel, uint8_t* dest, size_t size)
142142
(_T("CryptReleaseContext"), CryptReleaseContext(hProv, 0));
143143
#else
144144
int fd = open("/dev/urandom", O_RDONLY);
145-
assert(fd > 0);
145+
if (fd == -1)
146+
kernel->fatal("error opening /dev/urandom: %s", strerror(errno));
146147
size_t amount = 0;
147148
do {
148149
ssize_t ret = read(fd, dest+amount, size-amount);
149-
assert(ret >= 0);
150+
if (ret < 0)
151+
kernel->fatal("error reading /dev/urandom: %s", strerror(errno));
152+
else if (ret == 0)
153+
kernel->fatal("somehow hit eof reading from /dev/urandom");
150154
amount += (size_t)ret;
151155
} while (amount < size);
152-
int ret = close(fd);
153-
assert(ret == 0);
156+
(void) close(fd);
154157
#endif
155158
}
156159

0 commit comments

Comments
 (0)