home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20269 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.0 KB

  1. Path: sparky!uunet!ukma!bogus.sura.net!howland.reston.ans.net!usc!srhqla!quest!kdq
  2. From: kdq@quest.UUCP (Kevin D. Quitt)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: =======Problem with mmap command on DECStation========
  5. Message-ID: <1ge3XB4w165w@quest.UUCP>
  6. Date: Wed, 27 Jan 93 18:08:35 PST
  7. References: <1993Jan27.065349.27873@usage.csd.unsw.OZ.AU>
  8. Reply-To: srhqla!quest!kdq
  9. Organization: Job quest  (805) 251-8210,  So Cal: (800) 400-8210
  10. Lines: 17
  11.  
  12. roy@spectrum.cs.unsw.oz.au (Prabal Kumar Roy) writes:
  13. ...
  14. > However, at the statement    *intptr = 1; I am getting the following error.
  15. > pid 10810 (a.out) was killed on kernel access, at pc 0x400284.  Bus error (co
  16. > dumped).  
  17. ...
  18. >   result = (caddr_t) mmap(0, 1000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
  19. >   intptr = (int *) result;
  20. >   *intptr = 1;
  21.  
  22.     Uh, have you bothered to check 'result' to see if the return from
  23. mmap is a null pointer?  I assume that's what you'd get if the call
  24. fails.  I highly recommend such bulletproofing.
  25.  
  26.  
  27.  _
  28. Kevin D. Quitt      96.37% of all statistics are made up.     srhqla!quest!kdq
  29.