C Exit Not Executing


 
Thread Tools Search this Thread
Operating Systems AIX C Exit Not Executing
# 1  
Old 10-15-2017
C Exit Not Executing

Greetings all,

I am using an enterprise utility for document archiving. This program calls a custom C exit to do data manipulation before loading data into the archive.

When the program is called via an automation script (Ran as ROOT), program successfully executes the C exit, and gives me an RC 0.

When I try to execute the same program, I get a return code 16. I suspect that this is because of the exit. When I remove the exit from the processing, the program runs fine.

My account on the server has full sudo access.

Code:
-rwxr-xr-x    1 root     system        12342 Feb 19 2010  CustomExit

Can't seem to figure this out but I have a sneaking suspicion that this is due to permissions somewhere, since ROOT can run it, but my SUDO ID cant.

I've engaged vendor support, and they haven't helped. Anyone have an idea?
# 2  
Old 10-16-2017
I am assuming the LD_LIBRARY_PATH works in AIX as it does elsewhere. Please correct me if this is a bad assumption. EDIT: checked - 5.1 AIX and earlier uses LIBPATH, which may be brought forward to other newer releases. Newer releases use LD_LIBRARY_PATH as I expected.

See if you can successfully run the ldd command as yourself against the compiled program. Try it again as root user.

It could be that LD_LIBRARY_PATH needs to change for your user. The differences in output of the two ldd commands should give you a clue.

As an aside, subverting/reinventing system calls like exit() is generally a poor idea. And it is sometimes done by using replacement shared libraries and/or changing the LD_LIBRARY_PATH order of shared libraries.
# 3  
Old 10-16-2017
When I do an ldd against the exit itself as my own user -

Code:
 
 user@server:/dir/to/exit> ldd CustomExit
 CustomEXIT: No such file or directory

toss in sudo-

Code:
user@server:/dir/to/exit> ldd CustomExit
CustomExit/usr/lib/libcrypt.a(shr.o)
/usr/lib/libc.a(shr.o)

Code:
user@server:/dir/to/exit> echo $LD_LIBRARY_PATH
/usr/lpp/psf/bin

# 4  
Old 10-16-2017
Just because you have sudo does not mean your run as root all the time, which is what that ldd example shows. I'm not sure about the AIX syntax of the result - specifically the (shr.o)

It appears to be an object file file - somewhere - perhaps linked into the CustomExit code.

If an AIX person sees this it may help both of us. But IMO, you have some sort of permission issue. Example: the CustomExit code calls setuid()

Does nm CustomExit work for you (after sudo)? Please post the output.

And do you have a way of finding what exit code 16 - the error number - means for that app? Please post it if yes.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to keep staying on remote server after executing a shell script with if then exit end statement?

i have a "if .. then exit end " in s shell script on remote servers. now the connection to the remote server got killed after i run this script on the remote servers. How do i run this script on remote hosts and still keep remote connections alive after executing the script. Thank you. (10 Replies)
Discussion started by: moonmonk
10 Replies

2. Shell Programming and Scripting

Executing 'exit' command from shell script

Hi, I am writing shell script to automate few use cases for CLI interface. We have CLI interface which has bunch of commands. I am trying to execute one of the commands 'exit' as part of automation to exit from CLI object (not from shell script) in my shell script. My intension is to execute... (4 Replies)
Discussion started by: Mahesh Desai
4 Replies

3. UNIX for Dummies Questions & Answers

Execute shell script and if string found while executing then exit

Hi All, I have one shell script start.sh which executes another shell script test.sh something like below :test.sh -param1 -param2 In the test.sh there is one command for removing file:rm file1.bak I want whenever I execute start.sh, it will execute test.sh and if it finds string rm... (7 Replies)
Discussion started by: ORAI
7 Replies

4. Shell Programming and Scripting

Need the difference between exit 1 & exit 7

Hi In one of the script I am seeing some thing like exit 7,exit 1,exit 2,exit 3,exit 9,exit6.What is the difference between all of this exit.Can anyone help here please (3 Replies)
Discussion started by: ginrkf
3 Replies

5. Shell Programming and Scripting

Executing multiple processes without waiting for their exit status.

Hello Friends, Hope you are doing well. I just need a help in executing multiple processes. I've written a shell script which calls another scritps. But the problem is there are too many processes to run, and each process takes about a min to finish its execution. So, I want to just... (3 Replies)
Discussion started by: singh.chandan18
3 Replies

6. UNIX for Dummies Questions & Answers

nohup - sub job in script not executing until I exit

My job is launched using this command: I'm at home and having VPN drops so I used nohup and background. nohup perf_mon -c rating_4_multi,cfg & The main script is PID 26119, and the sub task under it is 26118 which is not running - just sits there. 26119 runs forever but nothing else runs. I... (2 Replies)
Discussion started by: ido1957
2 Replies

7. Programming

exit(0) versus exit(1)

What is the difference between using exit(0) and exit(1) to exit a program? Which should I use? (9 Replies)
Discussion started by: enuenu
9 Replies

8. Shell Programming and Scripting

bash: executing commands and reading exit vals

I have a function that returns a bunch of exit codes, say func1, and in my code I'm trying to execute that function in an if statement. This is the closest I could get. f1call=`func1 $arg1 $arg2` if ]; then ... fi When I run the script the function never gets called. What's the right way... (7 Replies)
Discussion started by: eur0dad
7 Replies

9. UNIX for Dummies Questions & Answers

Where can I find a list of exit codes? (Exit code 64)

I'm receiving an exit code 64 in our batch scheduler (BMC product control-m) executing a PERL script on UX-HP. Can you tell me where I can find a list of exit codes and their meaning. I'm assuming the exit code is from the Unix operating system not PERL. (3 Replies)
Discussion started by: jkuchar747
3 Replies
Login or Register to Ask a Question