We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
When calling syslog from an application loaded with DCE, if openlog was not called before, a 'Segmentation Fault' occurs, crashing the script.
syslog
openlog
Debugging the code, i have found out that the error occurs at the following line:
ns-3-dce/model/dce-syslog.cc
Line 69 in aa5de62
That is, when calling 'vprintf'. The failure happens because process->syslog is NULL, since dce_openlog was not called before to initialize it:
process->syslog
dce_openlog
Line 27 in aa5de62
The problem is that DCE expects that openlog be called before syslog, but according to 'https://linux.die.net/man/3/openlog':
The use of openlog() is optional; it will automatically be called by syslog() if necessary
To fix the problem, i believe that is just needed to call dce_openlog from dce_vsyslog when needed. That is:
dce_vsyslog
void dce_vsyslog (int priority, const char *message, va_list args) { NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << priority << message); NS_ASSERT (Current () != 0); Process *process = Current ()->process; if(process->syslog == NULL) { //Using default values, because dce_openlog ignores it dce_openlog(NULL, 0, 0); } vfprintf (process->syslog, message, args); fprintf (process->syslog, "\n"); }
Change the 'tenseconds.c' program (in myscripts/sleep) to:
myscripts/sleep
#include <unistd.h> #include <syslog.h> int main(int c, char **v) { syslog(LOG_WARNING, "Example"); sleep (10); return 1; }
and run the script normally: ./waf --run=dce-sleep
./waf --run=dce-sleep
You can check that running the changed program (tenseconds) directly does not cause failures:
$DCE_BUILD_PATH/bin_dce/tenseconds
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description of the problem
When calling
syslog
from an application loaded with DCE,if
openlog
was not called before, a 'Segmentation Fault' occurs, crashing the script.Debugging the code, i have found out that the error occurs at the following line:
ns-3-dce/model/dce-syslog.cc
Line 69 in aa5de62
That is, when calling 'vprintf'. The failure happens because
process->syslog
is NULL,since
dce_openlog
was not called before to initialize it:ns-3-dce/model/dce-syslog.cc
Line 27 in aa5de62
The problem is that DCE expects that
openlog
be called beforesyslog
,but according to 'https://linux.die.net/man/3/openlog':
Simple fix
To fix the problem, i believe that is just needed to call
dce_openlog
fromdce_vsyslog
when needed. That is:
Steps to reproduce
Change the 'tenseconds.c' program (in
myscripts/sleep
) to:and run the script normally:
./waf --run=dce-sleep
You can check that running the changed program (tenseconds) directly does not cause failures:
The text was updated successfully, but these errors were encountered: