Sponsored Content
Top Forums UNIX for Advanced & Expert Users capture sqsh segmentation fault error Post 302337463 by sudheer1984 on Friday 24th of July 2009 07:44:07 AM
Old 07-24-2009
capture sqsh segmentation fault error

hi all

is there any way to capture the segmentation fault error when i run sqsh on a unix shell script.

Ex:

Code:
 
#!/bin/ksh
sqsh -S "server" -U "user" -P "pwd" << EOF
use mydb
go
exec proc1
go
exit
EOF
retval=$?
echo "sqsh return value $retval"
if [ $retval != 0 ]
then
exit
fi

bcoz of my proc1 i am getting segmentation fault which prints error message only on console, but this error my script is not able to capture. it always print 0 as return value. is there any way to handle this situtation.

i tried this also
Code:
 
#!/bin/ksh
sqsh -S "server" -U "user" -P "pwd" << EOF 2>errfile
use mydb
go
exec proc1
go
exit
EOF
if [ ! -z `cat errfile | grep Segmentation` ]
then
exit
fi

please help.
thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Programming

segmentation fault

sometimes for this code i get a segmentation fault for codes llike this : int main{ int * a= 0; int b; a = (int*)malloc(sizeof(int)); ///some code using these variable but no freeing of a if(a){ free(a); a = 0; } return... (3 Replies)
Discussion started by: wojtyla
3 Replies

2. UNIX for Dummies Questions & Answers

What's the difference between Segmentation fault and Bus error and Illegal...?

What's the difference between Segmentation fault and Bus error and Illegal instruction? Sometimes I got the one, and sometimes i got another, what are their differences? Segmentation fault (core dump)? Bus error (core dump)? Illegal instruction (core dump) Thanks Daniel (2 Replies)
Discussion started by: lakeat
2 Replies

3. Programming

segmentation fault

If I do this. Assume struct life { char *nolife; } struct life **life; // malloc initialization & everything if(life->nolife == 0) Would I get error at life->nolife if it is equal to 0. wrong accession? (3 Replies)
Discussion started by: joey
3 Replies

4. Shell Programming and Scripting

Segmentation Fault(Core Dump) Error

Hi all, I have a folder with some 28 files. I have a script file that will iteratively take one file at a time from the folder and provide an output for the input file. Till the 7th file, there was no problem but from the 8th file onwards, i got this Segmentation Fault(Core Dump) error. A file... (2 Replies)
Discussion started by: mick_000
2 Replies

5. Programming

getting Segmentation Fault (core dumped) error but Program runs fine.

i am executing following program int main() { char str; FILE * fp; int i=0; ... (4 Replies)
Discussion started by: bhavesh.sapra
4 Replies

6. UNIX and Linux Applications

How to capture the value returned by a stored proc while executing it from SQSH connection

I have a very simple set up I am connecting to a MS SQL db using SQSH statement from a shell script In this sqsh connection i am trying to execute a stored proc However I want to capture the value returned by the stored proc. I haven't really come across anything useful so far which would... (0 Replies)
Discussion started by: shishirkotkar
0 Replies

7. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

8. Programming

Segmentation fault

I keep getting this fault on a lot of the codes I write, I'm not exactly sure why so I'd really appreciate it if someone could explain the idea to me. For example this code #include <stdio.h> main() { unsigned long a=0; unsigned long b=0; int z; { printf("Enter two... (2 Replies)
Discussion started by: sizzler786
2 Replies

9. Programming

Segmentation Fault ERROR in C

Hello guys, i have this code: int main(int argc, char *argv) { int i, j, N, result = 0, **vec; if (argc < 2) { fprintf(stderr, "Usage: %s N\n", argv); } /* ... how many numbers to read */ N = atoi(argv); /* check if N is a power of two; exit if not */ if (!... (3 Replies)
Discussion started by: DinisR
3 Replies

10. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
uucopy(2)							   System Calls 							 uucopy(2)

NAME
uucopy - no-fault memory-to-memory copy SYNOPSIS
#include <strings.h> int uucopy(const void *s1, void *s2, size_t n); DESCRIPTION
The uucopy() function copies n bytes from memory area s1 to s2. Copying between objects that overlap could corrupt one or both buffers. Unlike bcopy(3C), uucopy() does not cause a segmentation fault if either the source or destination buffer includes an illegal address. Instead, it returns -1 and sets errno to EFAULT. This error could occur after the operation has partially completed, so the contents of the buffer at s2 are defined if the operation fails. RETURN VALUES
Upon successful completion, uucopy() returns 0. Otherwise, the function returns -1 and set errno to indicate the error. ERRORS
The uucopy() function will fail if: EFAULT Either the s1 or s2 arguments points to an illegal address. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
bcopy(3C), attributes(5) SunOS 5.11 12 Sep 2006 uucopy(2)
All times are GMT -4. The time now is 07:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy