chiark / gitweb /
hostnamed: prevent it from crashing if the chassis is unknown
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Tue, 5 Nov 2013 23:30:29 +0000 (00:30 +0100)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Tue, 5 Nov 2013 23:30:29 +0000 (00:30 +0100)
When fallback_chassis would return null it led to a crash and an
empty result in hostnamectl. Only seen after the sd-port.

src/hostname/hostnamed.c

index 0854bc4..ece5d1d 100644 (file)
@@ -360,6 +360,9 @@ static int property_get_chassis(
         else
                 name = c->data[PROP_CHASSIS];
 
+        if(!name)
+                name = "";
+
         r = sd_bus_message_append(reply, "s", name);
         if (r < 0)
                 return r;