Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!decvax!decwrl!ucbvax!info-vax From: RIZZI@USC-ISIB.ARPA Newsgroups: mod.computers.vax Subject: Dereferencing NULL pointer in C Message-ID: <8602020523.AA28338@ucbvax.berkeley.edu> Date: Fri, 31-Jan-86 03:48:49 EST Article-I.D.: ucbvax.8602020523.AA28338 Posted: Fri Jan 31 03:48:49 1986 Date-Received: Sun, 2-Feb-86 11:52:54 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 30 Approved: info-vax@sri-kl.arpa I am porting a UNIX application written in C to VAX/VMS. Aside from file name translation, the biggest problem I have is in dealing with code that blithely dereferences NULL pointers, expecting a zero or null string. My understanding is that UNIX allows this, however VMS insists on an access violation which is disastrous. Not only does much of the application code ignore NULL pointers, but the VAX/VMS C runtime library does as well!! printf() and strcpy() among others are easily convinced to crash and burn. I have been able to catch the SIGBUS signal, using both signal() and sigvec() (VMS-specific), but have not been able to ignore it or return from my handler without a stack trace and program exit. I suspect that some mucking about with the sigcontext structure that arrives with a sigvec()-style signal might produce better results, but I am reluctant to attempt this. Is there someway available to recover from or ignore the SIGBUS signal or am I fated to pore thousands of lines of code in search of potential NULL pointer dereferences?? Thanks, Bill ARPA: RIZZI@ISIB UUCP: cca!ima!ism780b!billr -------