Re: Was: Rare Bug Now: Dumping Cores

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 10/09/01


On Tue, 9 Oct 2001, Patrick Dughi wrote:

>         Woohoo! Let's crack his machine via the mud!  He's given the
> process superuser privledges! Huzzah! :)

Then don't fiddle with the hard limit of the system.  You don't really
want to, anyway.  Set the soft limit and things will work as expected and
without you needing to be superuser.  Mailer Code(tm):

  /*
   * Setup system limits, such as coredumpsize on UNIX.
   * 0 on success, -1 on error.
   */
  int system_limits(void)
  {
    struct rlimit rl;

    if (getrlimit(RLIMIT_CORE, &rl) == -1) {
      perror("get(RLIMIT_CORE)");
      return (-1);
    }

    rl.rlim_cur = rl.rlim_max;

    if (setrlimit(RLIMIT_CORE, &rl) == -1) {
      perror("set(RLIMIT_CORE)");
      return (-1);
    }

    return (0);
  }

This sets the soft limit for the process to the hard limit for the
process.

-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST