|
From: | david . myers |
Subject: | [libmicrohttpd] Spawning processes from access handler callback |
Date: | Mon, 20 Apr 2015 15:56:34 +0000 |
User-agent: | Roundcube Webmail/1.0.2 |
Hi Christian, My embedded linux webserver uses thread-per-connection mode. Using either the linux system() call or the popen() call, I am issuing a linux "ifconfig" command in my access handler callback, every second, on command from a webpage. I wait for the result and return the result string to the webpage in the response string. I find that after a variable number of minutes, I get a memory scribble which crashes my webserver application/daemon. Any linux command seems to show the same problem so it's not related to the "ifconfig", it crashes the same with "ps" or "ls" commands. Is there any reason why issuing system() or popen() calls in the callback might be unsafe? Here's the code I call in the callback int GetNetStats(MHD_Connection * connection, const char * szCommand) /* Open the command for reading. */ pclose(fp); strResponse += "</body></html>"; //terminate response string return status; Best regards David Myers |
[Prev in Thread] | Current Thread | [Next in Thread] |