Attempting to correct the problem about which I earlier posted - wherein a system() call which apparently succeeds is perceived to have failed by the * process, I changed code in app_system.c so that it would be more discerning...

        res = system((char *)data);
        /*
        if (res < 0) {
                ast_log(LOG_WARNING, "Unable to execute '%s'\n", (char *)data);
                res = -1;
        } else if (res == 127) {
                ast_log(LOG_WARNING, "Unable to execute '%s'\n", (char *)data);
                res = -1;
        */
        if (res == -1) {
                ast_log(LOG_WARNING, "Fork failed for '%s'\n", (char *)data);
                res = -1;
        } else if (WEXITSTATUS(res) != 0) {
                ast_log(LOG_WARNING, "Error completion for '%s'\n", (char *)data);
                res = -1;
 
It is now indeed more discerning, but it has reported Fork failed.  But the fork most certainly has not failed!  The shell command invoked has run, and what's more, completed successfully, producing the expected files.

Referring to the system(2) man page (Red Hat 9, stock)...

RETURN VALUE
       The value returned is -1 on error (e.g. fork failed),  and  the  return
       status  of  the command otherwise.  This latter return status is in the
       format specified in wait(2).  Thus, the exit code of the  command  will
       be  WEXITSTATUS(status).   In  case  /bin/sh could not be executed, the
       exit status will be that of a command that does exit(127).

...and noting that "fork failed" is only an example of an error, I'm wondering what *other* condition might cause the -1 return value.

Does anyone have any ideas?

Reply via email to