]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/hostname/hostnamed.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / hostname / hostnamed.c
index 197f905b7dc8b25189f97f196c8cc1566324fe2d..a9d5d49bddd4f28365186713a150a88fccfc517d 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -133,6 +134,7 @@ static bool valid_chassis(const char *chassis) {
                         "container\0"
                         "desktop\0"
                         "laptop\0"
+                        "convertible\0"
                         "server\0"
                         "tablet\0"
                         "handset\0"
@@ -199,6 +201,10 @@ static const char* fallback_chassis(void) {
 
         case 0x1E: /* Tablet */
                 return "tablet";
+
+        case 0x1F: /* Convertible */
+        case 0x20: /* Detachable */
+                return "convertible";
         }
 
 try_acpi:
@@ -283,7 +289,7 @@ static int context_update_kernel_hostname(Context *c) {
 
         /* ... and the ultimate fallback */
         else
-                hn = "localhost";
+                hn = FALLBACK_HOSTNAME;
 
         if (sethostname_idempotent(hn) < 0)
                 return -errno;
@@ -335,7 +341,7 @@ static int context_write_data_machine_info(Context *c) {
                         continue;
                 }
 
-                t = strjoin(name[p], "=", c->data[p], NULL);
+                t = strjoin(name[p], "=", c->data[p]);
                 if (!t)
                         return -ENOMEM;
 
@@ -419,7 +425,7 @@ static int method_set_hostname(sd_bus_message *m, void *userdata, sd_bus_error *
                 name = c->data[PROP_STATIC_HOSTNAME];
 
         if (isempty(name))
-                name = "localhost";
+                name = FALLBACK_HOSTNAME;
 
         if (!hostname_is_valid(name, false))
                 return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid hostname '%s'", name);