Fix for https://github.com/rsyslog/rsyslog/issues/61

Based on Maxim Koltsov proposed patch from https://bugs.gentoo.org/show_bug.cgi?id=507730