[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gnupg compiled



On Sun, Jan 09, 2000 at 06:27:07PM +0100, Daniel Wagner wrote:
> 
> > > Well, here is what I did in exim, and you should do similar for GPG:
> > > 
> > >   if (setrlimit(RLIMIT_CORE, &rl) < 0)
> > >     {
> > >     #ifdef __GNU__
> > >     if (errno != ENOSYS && errno != ENOTSUP)
> > >     #endif
> > >       log_write(0, LOG_MAIN|LOG_PANIC, "setrlimit failed: %s", strerror(errno));
> > >     }
> > 
> > I don't think this needs to be #ifdef'd, just as a generic thing.
> 
> Hmm, I'm a bit confused. Look at this code:
> 
> void
> disable_core_dumps()
> {
>  #ifndef HAVE_DOSISH_SYSTEM
>   #ifdef HAVE_SETRLIMIT
>     struct rlimit limit;
>     limit.rlim_cur = 0;
>     limit.rlim_max = 0;
>     if( !setrlimit( RLIMIT_CORE, &limit ) )
>         return;
>     if( errno != EINVAL )
>         log_fatal(_("can't disable core dumps: %s\n"), strerror(errno) );
>   #endif
>     if( !opt.quiet )
>         log_info(_("WARNING: program may create a core file!\n"));
>  #endif
> }
> 
> Do you mean as long setrlimit is not really implemented this
> disable_core_dumps should run in the same way like on dosish systems?
> That means never!

Nah, we want to run it, but fail silently. I would change the above code to
this:

void
disable_core_dumps()
{
 #ifndef HAVE_DOSISH_SYSTEM
  #ifdef HAVE_SETRLIMIT
    struct rlimit limit;
    limit.rlim_cur = 0;
    limit.rlim_max = 0;
    if( !setrlimit( RLIMIT_CORE, &limit ) )
        return;
    if( errno == ENOSYS || errno == ENOTSUP )
	return;
    if( errno != EINVAL )
        log_fatal(_("can't disable core dumps: %s\n"), strerror(errno) );
   #endif
    if( !opt.quiet )
        log_info(_("WARNING: program may create a core file!\n"));
 #endif
}

Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org Check Key server 
Marcus Brinkmann              GNU    http://www.gnu.org    for public PGP Key 
Marcus.Brinkmann@ruhr-uni-bochum.de,     marcus@gnu.org    PGP Key ID 36E7CD09
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       brinkmd@debian.org


Reply to: