On Thu, 15 May 2008 14:49:26 -0400
"Bob McConnell" <[EMAIL PROTECTED]> wrote:

> >>> My code so far:
> >>>
> >>> ----------------- tear along dotted line -----------------
> >>>  tapFD = open ("/dev/tap0", O_RDWR);
> >>>  if (tapFD < 0) {
> >>>    fprintf (stderr, "Failed to open /dev/tap0: %d.\n", tapFD);
> >>>    exit (2);
> >>>  }
> >>>
> >>>  fprintf (stderr, "Successfully opened /dev/tap0.\n");
> >>>
> >>>  unsigned char * buffer = (unsigned char*)malloc(1514);
> >>>  if (buffer = NULL) {

       if (buffer == NULL) {


> >>>    fprintf (stderr, "No memory available.\n");
> >>>    close (tapFD);
> >>>    exit(3);
> >>>  }
> 
> When I replace the malloc with an automatic array, the
> error goes away and I get the data I am looking for. i.e.:
> 
>    unsigned char buffer[1514];
> 
> So why can't I use malloc to create that buffer?

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to