chiark / gitweb /
journal: handle empty syslog identifier properly
[elogind.git] / src / journal / journald.c
index 39263bfe4c41530e9431396f91886b4f68d95cba..f63a12fae86b656291a383152943b2337ef4afa7 100644 (file)
@@ -1405,10 +1405,14 @@ static int stdout_stream_line(StdoutStream *s, char *p) {
         switch (s->state) {
 
         case STDOUT_STREAM_IDENTIFIER:
-                s->identifier = strdup(p);
-                if (!s->identifier) {
-                        log_error("Out of memory");
-                        return -ENOMEM;
+                if (isempty(p))
+                        s->identifier = NULL;
+                else  {
+                        s->identifier = strdup(p);
+                        if (!s->identifier) {
+                                log_error("Out of memory");
+                                return -ENOMEM;
+                        }
                 }
 
                 s->state = STDOUT_STREAM_PRIORITY;