[Asterisk-Users] 'System' application exit with error evenifit performs the job as expected

Armand A. Verstappen armand at nl.envida.net
Sat Aug 2 13:05:00 MST 2003


On Fri, 2003-08-01 at 16:45, Dan wrote:
> > #include <stdlib.h>
> > #include <stdio.h>
> > 
> > int main() {
> > 
> >         int ret;
> > 
> >         ret = system("/bin/ls > /dev/null");
> > 
> >         printf("system(\"/bin/ls > /dev/null\") returned %d\n", ret);
> > 
> >         return(ret);
> > }
> > 
> > gcc mysystem.c -o mysystem
> > ./mysystem
> > 
> > what is the output?
> 
> On Fri, 2003-08-01 at 10:40, Dan wrote:
> > This is the result:
> > 
> > [root at danpbx temp]# ./mysystem
> > system("/bin/ls > /dev/null") returned 0
> > [root at danpbx temp]#
> 
> Okay, that at least rules out the suggestion earlier in this thread that
> your systems' system call is broken.

(line below moved down from top back into context)
> Then?
> What can it be?

Don't know really. I'd change app_system.c, to tell me what the exact
return code we got:
... 
        /* Do our thing here */
        res = system((char *)data);
        if (res < 0) {
                ast_log(LOG_WARNING, "Unable to execute '%s' (result
%d)\n", (char *)data, res);
                res = -1;
        } else if (res == 127) {
                ast_log(LOG_WARNING, "Unable to execute '%s' (result
%d)\n", (char *)data);
                res = -1;
        }
...

and recompile and install app_system.so. It would help you to know what
the return code was that is causing you problems. I'm not sure how that
would help you, but it is the one thing I can think of that would get
you more information.

wkr,

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in email?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20030802/e02462a8/attachment.pgp


More information about the asterisk-users mailing list