Branch: Tag:

1997-10-05

1997-10-05 17:31:47 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Should now work on HPUX again.

Rev: src/modules/Pipe/pipe.c:1.13

22:   #include <fcntl.h>      #include "global.h" - RCSID("$Id: pipe.c,v 1.12 1997/10/05 03:31:09 per Exp $"); + RCSID("$Id: pipe.c,v 1.13 1997/10/05 17:31:47 grubba Exp $");      #include "threads.h"   #include "stralloc.h"
627: Inside #if defined(HAVE_MMAP) && defined(HAVE_MUNMAP) and #if defined(HAVE_MADVISE)
   i->u.mmap=m;   #ifdef HAVE_MADVISE    /* Mark the pages as sequential read only access... */ +  +  /* NOTE: +  * +  * Potential race-condition with other threads +  */ +    #ifdef HAVE_GETEUID -  if((ou=geteuid()) && !getuid()) seteuid(0); +  if((ou=geteuid()) && !getuid()) { + #ifdef HAVE_SETEUID +  seteuid(0); + #else /* ! HAVE_SETEUID */ + #ifdef HAVE_SETREUID +  setresuid(-1, 0, -1); + #endif /* HAVE_SETRESUID */ + #endif /* HAVE_SETEUID */ +  }   #endif    madvise(m, s.st_size, MADV_SEQUENTIAL);   #ifdef HAVE_GETEUID -  if(ou) seteuid(ou); +  if(ou) { + #ifdef HAVE_SETEUID +  seteuid(0); + #else /* ! HAVE_SETEUID */ + #ifdef HAVE_SETREUID +  setresuid(-1, ou, -1); + #endif /* HAVE_SETRESUID */ + #endif /* HAVE_SETEUID */ +  }   #endif   #endif    pop_n_elems(args);