|
Home > Archive > Unix Programming > May 2005 > execvp and nvmatch () issue on solaris
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
execvp and nvmatch () issue on solaris
|
|
| Shekar 2005-05-01, 6:21 pm |
| All,
I am trying to execute a binary "mybinary" with arguments using
execvp() system call as in:
BTW: I can run "bin/mybinary hello" from command line and it returns
the right value.
char * const myargc[]={"bin/mybinary","hello",NULL};
if (execvp(myargc[0],myargc) == -1)
perror("execvp");
I am getting SIGSEGV and this is what gdb shows:
Program received signal SIGSEGV, Segmentation fault.
0xff2b9dd8 in nvmatch ()
(gdb) bt
#0 0xff2b9dd8 in nvmatch ()
#1 0xff2b9e8c in getenv ()
#2 0xff2b7fb4 in execvp ()
#3 0x10dc4 in main (argc=3, argv=0xffbefdb4) at myhandler.c:154
I would really appreciate if someone could put some light on to this
issue.
Thanks,
Shekar
| |
| Casper H.S. Dik 2005-05-01, 6:21 pm |
| "Shekar" <ctippur@msn.com> writes:
>All,
>I am trying to execute a binary "mybinary" with arguments using
>execvp() system call as in:
>BTW: I can run "bin/mybinary hello" from command line and it returns
>the right value.
>char * const myargc[]={"bin/mybinary","hello",NULL};
>if (execvp(myargc[0],myargc) == -1)
> perror("execvp");
>I am getting SIGSEGV and this is what gdb shows:
>Program received signal SIGSEGV, Segmentation fault.
>0xff2b9dd8 in nvmatch ()
>(gdb) bt
>#0 0xff2b9dd8 in nvmatch ()
>#1 0xff2b9e8c in getenv ()
>#2 0xff2b7fb4 in execvp ()
>#3 0x10dc4 in main (argc=3, argv=0xffbefdb4) at myhandler.c:154
>I would really appreciate if someone could put some light on to this
>issue.
Please post self-contained source showing the issue.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
| |
| Barry Margolin 2005-05-01, 6:21 pm |
| In article <1114720893.623716.124820@f14g2000cwb.googlegroups.com>,
"Shekar" <ctippur@msn.com> wrote:
> All,
>
> I am trying to execute a binary "mybinary" with arguments using
> execvp() system call as in:
> BTW: I can run "bin/mybinary hello" from command line and it returns
> the right value.
> char * const myargc[]={"bin/mybinary","hello",NULL};
> if (execvp(myargc[0],myargc) == -1)
> perror("execvp");
>
> I am getting SIGSEGV and this is what gdb shows:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xff2b9dd8 in nvmatch ()
> (gdb) bt
> #0 0xff2b9dd8 in nvmatch ()
> #1 0xff2b9e8c in getenv ()
> #2 0xff2b7fb4 in execvp ()
> #3 0x10dc4 in main (argc=3, argv=0xffbefdb4) at myhandler.c:154
>
> I would really appreciate if someone could put some light on to this
> issue.
My guess is something has corrupted your environment array. Perhaps you
have pointer problems, and earlier in the program something wrote
through a bad pointer that pointed into the environment.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
| |
| Shekar 2005-05-01, 6:21 pm |
| You are right. If I have this as a standalone code, it seems like it is
working but on a bigger context, it is not working.
Thanks for your input.
Shekar
|
|
|
|
|