~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to bin/trampoline/trampoline.c

  • Committer: David Coles
  • Date: 2009-08-06 04:04:37 UTC
  • Revision ID: coles.david@gmail.com-20090806040437-a8k5jhkkf2ixud5a
Add a rather lenient RLIMIT_NPROC that will prevent simple fork bombs (hopefully accidental...) from taking down a server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
402
402
        /* File Size */
403
403
        l.rlim_cur = 64 * 1024 * 1024; /* 64MiB */
404
404
        l.rlim_max = 72 * 1024 * 1024; /* 72MiB */
405
 
if (setrlimit(RLIMIT_FSIZE, &l))
 
405
        if (setrlimit(RLIMIT_FSIZE, &l))
406
406
        {
407
407
            perror("could not setrlimit/RLIMIT_FSIZE");
408
408
            exit(1);
409
409
        }
 
410
        
 
411
        /* Number of Processes */
 
412
        l.rlim_cur = 50;
 
413
        l.rlim_max = 50;
 
414
        if (setrlimit(RLIMIT_NPROC, &l))
 
415
        {
 
416
            perror("could not setrlimit/RLIMIT_NPROC");
 
417
            exit(1);
 
418
        }
410
419
    }
411
420
 
412
421
    /* Remove any signal handler masks so we can send signals to the child */