[cups] cupsdStartProcess question
Dmitry Voronin
carriingfate92 at yandex.ru
Sun May 8 22:16:27 PDT 2016
Hello,
For my reasons in CUPS I need execute external program and save output into file.
I determine, that function cupsdStartProcess is more suitable, that system or exec* function.
So, I have following code:
outfd = open('/tmp/exec", O_WRONLY);
status = cupsdStartProcess(command, argv, envp,
-1 /* intfd */,
outfd /* opened early */,
-1 /* errfd */,
-1 /* backfd */,
-1 /* sidefd */,
1 /* execute as root */,
NULL /* profile */,
NULL /*job */,
&pid /* running pid */);
if (!status)
close(outfd);
else
{
close(outfd);
unlink("/tmp/exec");
}
When those code is executed, I expect, that in file with fd outfd it was written output of my command. But those file is empty. In /var/spool/cups/tmp/ (I use Debian)
CUPS create a random file with neede for me output.
What am I doing wrong?
Thank you.
--
Best regards, Dmitry Voronin
More information about the cups
mailing list