Fix UnixSyslog message ident corruption (#20)

According to openlog(3) documentation:

    if the string *ident points to ceases to exist,
    the results are undefined". So we have to
    keep the identBuffer during the existence of
    the Syslog object.

Closes #21
This commit is contained in:
mrazavi64 2017-04-29 15:50:40 +04:30 committed by Jochen Schalanda
parent 76bdd8a823
commit 07b08649a8

View File

@ -37,6 +37,8 @@ public class UnixSyslog extends AbstractSyslog {
public void closelog();
}
protected static Memory identBuffer = null;
protected static int currentFacility = -1;
protected static boolean openlogCalled = false;
@ -81,8 +83,6 @@ public class UnixSyslog extends AbstractSyslog {
ident = null;
}
Memory identBuffer = null;
if (ident != null) {
identBuffer = new Memory(128);
identBuffer.setString(0, ident, false);