Justin Cormack wrote: > Module Name: src > Committed By: justin > Date: Tue Jul 22 22:41:58 UTC 2014 > > Modified Files: > src/lib/librumpuser: Makefile rumpfiber.c rumpuser.c rumpuser_int.h > rumpuser_port.h > Added Files: > src/lib/librumpuser: rumpuser_random.c > > Log Message: > Clean up random implementation for librumpuser > > Use /dev/urandom for platforms without arc4random, not srandom(), > deduplicate code, do not read excessive random bytes > > Reviewed by pooka@ > > ... > +int > +rumpuser__random_init(void) > +{ > + > + random_fd = open(random_device, O_RDONLY); > + if (random_fd < 0) { > + fprintf(stderr, "random init open failed\n"); > + return 1; > + }
return -1 ? > ... > #else > #define ET(_v_) return (_v_) ? rumpuser__errtrans(_v_) : 0; > #endif > + rv = read(random_fd, buf, buflen > random_maxread ? random_maxread : > buflen); > + if (rv < 0) { > + ET(errno); > + } I know it's not your code and it's not touched by your change but ET(errno) looks a bit cryptic. If it appeared as 'return ERRTRANS(errno)', that would significantly increase readability. ET(0) can be changed to 'return 0'. Alex