Skip to content

Commit e58c191

Browse files
jesse99brson
authored andcommitted
---
yaml --- r: 40530 b: refs/heads/dist-snap c: 8adacc0 h: refs/heads/master v: v3
1 parent 4b7254e commit e58c191

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
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
99
refs/heads/incoming: e90142e536c150df0d9b4b2f11352152177509b5
10-
refs/heads/dist-snap: 3ac90ec9f8eb1ad74c73f15268b19e472fc96b76
10+
refs/heads/dist-snap: 8adacc06aa66e6a84849af8699b8eed8fcbd5764
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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)