Branch: Tag:

2000-05-21

2000-05-21 18:19:35 by Henrik Grubbström (Grubba) <grubba@grubba.org>

HAVE_BROKEN_LINUX_THREAD_EUID is now used by the farmers too.

Rev: src/threads.c:1.126

1:   #include "global.h" - RCSID("$Id: threads.c,v 1.125 2000/05/20 18:43:18 grubba Exp $"); + RCSID("$Id: threads.c,v 1.126 2000/05/21 18:19:35 grubba Exp $");      int num_threads = 1;   int threads_disabled = 0;
1383:    void (*harvest)(void *);    THREAD_T me;    COND_T harvest_moon; + #ifdef HAVE_BROKEN_LINUX_THREAD_EUID +  int euid, egid; + #endif /* HAVE_BROKEN_LINUX_THREAD_EUID */   } *farmers;      static MUTEX_T rosie STATIC_MUTEX_INIT;
1393:   static TH_RETURN_TYPE farm(void *_a)   {    struct farmer *me = (struct farmer *)_a; +  + #ifdef HAVE_BROKEN_LINUX_THREAD_EUID +  /* Work-around for Linux's pthreads not propagating the +  * effective uid & gid. +  */ +  if (!geteuid()) { +  setegid(me->egid); +  seteuid(me->euid); +  } + #endif /* HAVE_BROKEN_LINUX_THREAD_EUID */ +     do    {   /* if(farmers == me) fatal("Ouch!\n"); */
1449:    me->field = args;    me->harvest = fun;    co_init( &me->harvest_moon ); +  + #ifdef HAVE_BROKEN_LINUX_THREAD_EUID +  me->euid = geteuid(); +  me->egid = getegid(); + #endif /* HAVE_BROKEN_LINUX_THREAD_EUID */ +     th_create_small(&me->me, farm, me);    return me;   }