chiark / gitweb /
[PATCH] rename attributes to options
[elogind.git] / namedev_parse.c
index eabd9c98bb1957f089af68b14e958cf7d22fd009..ed38db4b142267e6f617cff36af0482c4306058a 100644 (file)
@@ -153,7 +153,7 @@ static int namedev_parse(const char *filename, void *data)
 
                /* skip backslash and newline from multi line rules */
                for (i = j = 0; i < count; i++) {
-                       if (bufline[i] == '\\' || bufline[i] == '\n')
+                       if (bufline[i] == '\\' && bufline[i+1] == '\n')
                                continue;
 
                        line[j++] = bufline[i];
@@ -250,16 +250,19 @@ static int namedev_parse(const char *filename, void *data)
                                attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1);
                                /* FIXME: remove old style options and make OPTIONS= mandatory */
                                if (attr != NULL) {
-                                       if (strstr(attr, ATTR_PARTITIONS) != NULL) {
+                                       if (strstr(attr, OPTION_PARTITIONS) != NULL) {
                                                dbg_parse("creation of partition nodes requested");
                                                dev.partitions = DEFAULT_PARTITIONS_COUNT;
                                        }
-                                       if (strstr(attr, ATTR_IGNORE_REMOVE) != NULL) {
+                                       if (strstr(attr, OPTION_IGNORE_REMOVE) != NULL) {
                                                dbg_parse("remove event should be ignored");
                                                dev.ignore_remove = 1;
                                        }
                                }
-                               strfieldcpy(dev.name, temp3);
+                               if (temp3[0] != '\0')
+                                       strfieldcpy(dev.name, temp3);
+                               else
+                                       dev.ignore_device = 1;
                                valid = 1;
                                continue;
                        }
@@ -289,15 +292,15 @@ static int namedev_parse(const char *filename, void *data)
                        }
 
                        if (strcasecmp(temp2, FIELD_OPTIONS) == 0) {
-                               if (strstr(temp3, ATTR_IGNORE_DEVICE) != NULL) {
+                               if (strstr(temp3, OPTION_IGNORE_DEVICE) != NULL) {
                                        dbg_parse("device should be ignored");
                                        dev.ignore_device = 1;
                                }
-                               if (strstr(temp3, ATTR_IGNORE_REMOVE) != NULL) {
+                               if (strstr(temp3, OPTION_IGNORE_REMOVE) != NULL) {
                                        dbg_parse("remove event should be ignored");
                                        dev.ignore_remove = 1;
                                }
-                               if (strstr(temp3, ATTR_PARTITIONS) != NULL) {
+                               if (strstr(temp3, OPTION_PARTITIONS) != NULL) {
                                        dbg_parse("creation of partition nodes requested");
                                        dev.partitions = DEFAULT_PARTITIONS_COUNT;
                                }