summaryrefslogtreecommitdiff
path: root/entropy.c
diff options
context:
space:
mode:
authorTim Rice <tim@multitalents.net>2002-04-21 11:26:10 -0700
committerTim Rice <tim@multitalents.net>2002-04-21 11:26:10 -0700
commitf02dccc0dc5711d5bdfb45f92a2f1bba41e365f0 (patch)
treedb24726055f610d63839c5f1c6bcfb0f72e5d35a /entropy.c
parenta370f4dcc6ae04c430ad97c28a2bd945c2350120 (diff)
[entropy.c.] Portability fix for SCO Unix 3.2v4.x (SCO OSR 3.0).
entropy.c needs seteuid(getuid()) for the setuid(original_uid) to succeed. Patch by gert@greenie.muc.de. This fixes one part of Bug 208
Diffstat (limited to 'entropy.c')
-rw-r--r--entropy.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/entropy.c b/entropy.c
index 84c15eb7..da1a391f 100644
--- a/entropy.c
+++ b/entropy.c
@@ -45,7 +45,7 @@
* XXX: we should tell the child how many bytes we need.
*/
-RCSID("$Id: entropy.c,v 1.42 2002/04/18 12:53:27 djm Exp $");
+RCSID("$Id: entropy.c,v 1.43 2002/04/21 18:26:10 tim Exp $");
#ifndef OPENSSL_PRNG_ONLY
#define RANDOM_SEED_SIZE 48
@@ -87,9 +87,10 @@ seed_rng(void)
close(devnull);
if (original_uid != original_euid &&
- setuid(original_uid) == -1) {
- fprintf(stderr, "(rand child) setuid: %s\n",
- strerror(errno));
+ ( seteuid(getuid()) == -1 ||
+ setuid(original_uid) == -1) ) {
+ fprintf(stderr, "(rand child) setuid(%d): %s\n",
+ original_uid, strerror(errno));
_exit(1);
}