int cht_get_urandom(Tcl_Interp *ip, Byte *buffer, int l) {
static FILE *urandom;
- int r, esave;
+ int r;
if (!urandom) {
urandom= fopen(URANDOM,"rb");
r= fread(buffer,1,l,urandom);
if (r==l) return 0;
- esave= errno;
- fclose(urandom); urandom=0;
-
if (ferror(urandom)) {
- return cht_posixerr(ip,errno,"read " URANDOM);
+ r = cht_posixerr(ip,errno,"read " URANDOM);
} else {
assert(feof(urandom));
- return cht_staticerr(ip, URANDOM " gave eof!", 0);
+ r = cht_staticerr(ip, URANDOM " gave eof!", 0);
}
+ fclose(urandom); urandom=0;
+ return r;
}
void cht_prepare__basic(Tcl_Interp *ip) {
-chiark-tcl (1.1.1) unstable; urgency=low
+chiark-tcl (1.1.1~~iwj) unstable; urgency=low
+
+ Bugfix:
+ * Handling of errors reading /dev/urandom fixed. (Also, fixes
+ FTBFS in sid due to warning from recent versions of gcc.)
User-visible change:
* Mention dgram, tuntap and maskmap in Description. Fix typo.