chiark / gitweb /
[PATCH] udev - reverse user query options
[elogind.git] / namedev_parse.c
index 98e822dfef4bd82c34350179602b6e02d780b741..546d767aed6a665f55cd9156adac6a6f3cc035d8 100644 (file)
  *
  */
 
-/* define this to enable parsing debugging */
+#ifdef DEBUG
+/* define this to enable parsing debugging also */
 /* #define DEBUG_PARSER */
+#endif
 
 #include <stddef.h>
 #include <stdlib.h>
@@ -34,6 +36,7 @@
 #include <errno.h>
 
 #include "udev.h"
+#include "logging.h"
 #include "namedev.h"
 
 static int add_config_dev(struct config_device *new_dev)
@@ -230,7 +233,9 @@ int namedev_init_rules(void)
                                continue;
                        }
 
-                       dbg_parse("unknown type of field '%s'", temp2);
+                       dbg("unknown type of field '%s'", temp2);
+                       dbg("You might be using a rules file in the old format, please fix.");
+                       goto error;
                }
 
                /* simple plausibility check for given keys */
@@ -245,12 +250,13 @@ int namedev_init_rules(void)
                        goto error;
                }
 
+               dev.config_line = lineno;
                retval = add_config_dev(&dev);
                if (retval) {
                        dbg("add_config_dev returned with error %d", retval);
                        continue;
 error:
-                       dbg("%s:%d:%Zd: parse error, rule skipped",
+                       dbg("%s:%d:%d: parse error, rule skipped",
                                  udev_rules_filename, lineno, temp - line);
                }
        }
@@ -318,7 +324,7 @@ int namedev_init_permissions(void)
                        dbg("cannot parse line '%s'", line);
                        continue;
                }
-               strncpy(dev.group, temp2, sizeof(dev.owner));
+               strncpy(dev.group, temp2, sizeof(dev.group));
 
                if (!temp) {
                        dbg("cannot parse line: %s", line);