HP-UX 64 compilation causing some code to seg fault


 
Thread Tools Search this Thread
Operating Systems HP-UX HP-UX 64 compilation causing some code to seg fault
# 1  
Old 06-06-2008
HP-UX 64 compilation causing some code to seg fault

Hello everyone,

Today we are attempting to port some legacy C code to a 64 HP-UX machine at my company and there is kind of a strange error we ran into.

there is a small function they have defined called zgetenv that
accepts a char* and basically just does some null checking and returns
getenv(char*)

the function works fine if i copy it into the file im attempting to recompile and change nothing other than the name of the function.
but when i attempt to call this function from the library that we have recompiled for the 64 bit machine I get a segmentation fault on the
returned value if i call a strlen or strcpy on it.

the strange thing is that this function is being called all over the place in this code and it only gives seg faults in this one module for some reason...

the only possible problem i can think of would be that we havent correctly linked this module to the new 64 bit compilation or something but I dont think that would result in a segmentation fault...

I am really really lost and any help would be much appreciated.

Thanks, Eric
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Source code compilation

Need assistance in Source code compilation . When installing a software compiling a source code . Whatever the output that prints on the screen i want to log it into a file. How can i see output and store the output to file ./configure make make install Is there other way of seeing output... (5 Replies)
Discussion started by: ajayram_arya
5 Replies

2. Programming

This code keeps giving me a segmentation fault why?

#include<stdlib.h> #include <pthread.h> #include "tlpi_hdr.h" #include <stdio.h> static volatile int glob = 0; static struct { pthread_t t1,t2; } *thread; static void * /* Loop 'arg' times incrementing 'glob' */ threadFunc(void *arg) { int loops = *((int *) arg); ... (1 Reply)
Discussion started by: fwrlfo
1 Replies

3. Shell Programming and Scripting

sort -t option causing code to fail need ASCII character

Hello, When I run this UNIX code without the -t option it gives me the desired results. The code keeps the record with the greatest datetime based on the key columns. I sort it first then sort it again with the -u option, that's it. I need to have a variable to specify an ASCII character... (2 Replies)
Discussion started by: script_op2a
2 Replies

4. Programming

C code : Segmentation fault

Hi Friends, I have written a small code in C which performs the below operations Task : 1 ) read line by line from a file. 2 ) assuming 3th and 4th fields of the file as GN and GNTO 3 ) The target file should contain all the fields except GNTO. 4... (3 Replies)
Discussion started by: kiran_bhatter
3 Replies

5. Programming

Compilation error when compiling Pro*C code

I'm running a query similar to the one that I'm describing below -: _______________________________ EXEC SQL INSERT INTO TABLE1 ( C1 ,C2 ,C3 ,C4 ) (SELECT DISTINCT B.V1 ,B.V2 ,( SELECT D.V3 FROM TABLE2 D WHERE D.V3 = C.V4) ,B.V4 FROM TABLE2 B ,TABLE3 C WHERE B.V3 = C.V4) ;... (1 Reply)
Discussion started by: maheshp
1 Replies

6. Programming

Program exited with code 01: does it indicate unsuccessful compilation?

(gdb) r --------------------- enter Breakpoint 1, 0x0000000000409d40 in main () (gdb) n Single stepping until exit from function main, which has no line number information. Find_Cmd_Option: found option no. 2: seed (s) Find_Cmd_Option: found option no. 5: dfile (c) Initial no. div... (1 Reply)
Discussion started by: cdbug
1 Replies

7. Programming

Seg Fault Running AIX COBOL program

Hi some help read............ I'm getting a segmentation fault when I run an AIX COBOL/Db2 program. I initiate the program from the command line, but it hangs, and then when I press enter it generates a segmantation fault and produces a core dump. The box is running AIX software level ... (5 Replies)
Discussion started by: steve_f
5 Replies

8. Programming

Xlib Problem: XCloseDisplay seg fault

Hi, First of all forgive me if Xlib related problems does not go under this thread. In my main program, im using Xlib`s XImage type object which contains a regularly updating bitmap, and maps the XImage to a Xwindow using XPutImage. ( XCreateImage is used to create the XImage. ) The... (0 Replies)
Discussion started by: wolwy_pete
0 Replies

9. Programming

compilation parameters, code optimization

Hi all, I implemented an application, through using c++ and compiled it with g++. At first, what I did is (@ compilation): g++ calcBacon.C -o test -DDEBUG after I ran my application it took almost 120 sec. to finish its execution when I compiled with optimization parameters, execution... (5 Replies)
Discussion started by: SaTYR
5 Replies

10. Programming

Open Suse 10 seg fault

Okay, so here is some code that when compiled on Fedora Core 6 works great, but when I compile and run it on OpenSuse 10 it gives back a seg fault when trying to join the 2nd thead. #include <pthread.h> #include <stdio.h> int print_message_function( void *ptr ); int x = 1; main() { ... (1 Reply)
Discussion started by: chrisdrobison
1 Replies
Login or Register to Ask a Question
pfm_cleanup(3ncs)														 pfm_cleanup(3ncs)

Name
       pfm_cleanup - establish a clean-up handler

Syntax
       #include <idl/c/base.h>
       #include <idl/c/pfm.h>

       status_$t pfm_$cleanup(cleanup_record)
       pfm_$cleanup_rec *cleanup_record;

Arguments
       cleanup_record	   A  record  of the context when is called.  A program should treat this as an opaque data structure and not try to alter
			   or copy its contents.  It is needed by and to restore the context of the calling process at the clean-up handler  entry
			   point.

Description
       The  routine  establishes a clean-up handler that is executed when a fault occurs.  A clean-up handler is a piece of code executed before a
       program exits when a signal is received by the process.	The clean-up handler begins where is called; the routine registers an entry  point
       with the system where program execution resumes when a fault occurs.  When a fault occurs, execution resumes after the most recent call to

       There  can  be  more  than one clean-up handler in a program.  Multiple clean-up handlers are executed consecutively on a last-in/first-out
       basis, starting with the most recently established handler and ending with the first clean-up  handler.	 The  system  provides	a  default
       clean-up  handler  established at program invocation.  The default clean-up handler is always called last, just before a program exits, and
       releases any system resources still held, before returning control to the process that invoked the program.

Diagnostics
       When called to establish a clean-up handler, returns the status pfm_$cleanup_set to indicate the clean-up handler was  successfully  estab-
       lished.	 When the clean-up handler is entered in response to a fault signal, effectively returns the value of the fault that triggered the
       handler.

       This section lists status codes for errors returned by this routine in

       pfm_$bad_rls_order  Attempted to release a clean-up handler out of order.

       pfm_$cleanup_not_found
			   There is no pending clean-up handler.

       pfm_$cleanup_set    A clean-up handler was established successfully.

       pfm_$cleanup_set_signaledl
			   Attempted to use pfm_$cleanup_set as a signal.

       pfm_$invalid_cleanup_rec
			   Passed an invalid clean-up record to a routine.

       pfm_$no_space	   Cannot allocate storage for a clean-up handler.  Clean-up handler code runs with asynchronous faults  inhibited.   When
			   returns  something  other  than  pfm_$cleanup_set indicating that a fault has occurred, there are four possible ways to
			   leave the clean-up code:

			   o	  The program can call to start the next clean-up handler with a different fault signal.

			   o	  The program can call to start the next clean-up handler with the same fault signal.

			   o	  The program can continue with the code following the clean-up handler.  It should  generally	call  to  reenable
				  asynchronous	faults.   Execution  continues from the end of the clean-up handler code; it does not resume where
				  the fault signal was received.

			   o	  The program can reestablish the handler by calling before proceeding.

Files
See Also
       intro(3ncs), pfm_signal(3ncs)

																 pfm_cleanup(3ncs)