[OpenSIPS-Devel] [opensips] added exec(cmd, output, input, avpenv) function for exec module (#360)

Walter Doekes notifications at github.com
Thu Oct 16 16:08:39 CEST 2014


> +	} else if (outvar) {
> +		pid = __popen(command->s, "r", &pout);
> +	} else {
> +		pid = fork();
> +		if (pid == 0) {
> +			execl("/bin/sh", "/bin/sh", "-c", command->s, NULL);
> +			exit(-1);
> +		}
> +	}
> +
> +	if (input->len) {
> +		if (fwrite(input->s, 1, input->len, pin) != input->len) {
> +			LM_ERR("failed to write to pipe\n");
> +			ser_error=E_EXEC;
> +			goto error;
> +		}

This will stall if there is lots of output before the input is needed.

Pipes won't buffer an unlimited amount of data, and I doube that FILE streams will either.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/360/files#r18956935
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20141016/dbe9215d/attachment.htm>


More information about the Devel mailing list