chiark / gitweb /
udevd: fix REMOVE handling
[elogind.git] / src / libelogind / sd-device / device-private.c
index 86d760cddf0f788e4c6ac44ea1778c46f3feb15f..3cadedbf4a6e513ee106b7988e865c2ff23489ae 100644 (file)
@@ -423,9 +423,10 @@ static int device_amend(sd_device *device, const char *key, const char *value) {
                 size_t l;
 
                 FOREACH_WORD(word, l, value, state) {
-                        char *devlink;
+                        char devlink[l + 1];
 
-                        devlink = strndupa(word, l);
+                        strncpy(devlink, word, l);
+                        devlink[l] = '\0';
 
                         r = device_add_devlink(device, devlink);
                         if (r < 0)
@@ -436,9 +437,10 @@ static int device_amend(sd_device *device, const char *key, const char *value) {
                 size_t l;
 
                 FOREACH_WORD_SEPARATOR(word, l, value, ":", state) {
-                        char *tag;
+                        char tag[l + 1];
 
-                        tag = strndupa(word, l);
+                        (void)strncpy(tag, word, l);
+                        tag[l] = '\0';
 
                         r = device_add_tag(device, tag);
                         if (r < 0)
@@ -1098,3 +1100,9 @@ int device_delete_db(sd_device *device) {
 
         return 0;
 }
+
+int device_read_db_force(sd_device *device) {
+        assert(device);
+
+        return device_read_db_aux(device, true);
+}