Skip to content

Commit 07b0864

Browse files
admiritojoschi
authored andcommitted
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
1 parent 76bdd8a commit 07b0864

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/graylog2/syslog4j/impl/unix/UnixSyslog.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ protected interface CLibrary extends Library {
3737
public void closelog();
3838
}
3939

40+
protected static Memory identBuffer = null;
41+
4042
protected static int currentFacility = -1;
4143
protected static boolean openlogCalled = false;
4244

@@ -81,8 +83,6 @@ protected static void write(int level, String message, UnixSyslogConfig config)
8183
ident = null;
8284
}
8385

84-
Memory identBuffer = null;
85-
8686
if (ident != null) {
8787
identBuffer = new Memory(128);
8888
identBuffer.setString(0, ident, false);

0 commit comments

Comments
 (0)