Branch: Tag:

2003-10-06

2003-10-06 13:01:31 by Martin Stjernholm <mast@lysator.liu.se>

Don't be so harsh if the prctl calls fail to fix the dumpable flag on Linux.

Rev: src/threads.c:1.170

1:   #include "global.h" - RCSID("$Id: threads.c,v 1.169 2003/05/07 21:01:03 mast Exp $"); + RCSID("$Id: threads.c,v 1.170 2003/10/06 13:01:31 mast Exp $");      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0;
620: Inside #if defined(HAVE_BROKEN_LINUX_THREAD_EUID) and #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
   /* The sete?id calls will clear the dumpable state that we might    * have set with system.dumpable. */    int current = prctl(PR_GET_DUMPABLE); + #ifdef PIKE_DEBUG +  if (current == -1) +  fprintf (stderr, "%s:%d: Unexpected error from prctl(2). errno=%d\n", +  __FILE__, __LINE__, errno);   #endif -  + #endif    setegid(arg.egid);    seteuid(arg.euid);   #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) -  if (prctl(PR_SET_DUMPABLE, current) == -1) -  fatal ("Didn't expect prctl to go wrong. errno=%d\n", errno); +  if (current != -1 && prctl(PR_SET_DUMPABLE, current) == -1) { + #if defined(PIKE_DEBUG) +  fprintf (stderr, "%s:%d: Unexpected error from prctl(2). errno=%d\n", +  __FILE__, __LINE__, errno);   #endif    } -  + #endif +  }   #endif /* HAVE_BROKEN_LINUX_THREAD_EUID */       mt_lock_interpreter();