chiark / gitweb /
dbus-unit: expose PartOf/ConsistsOf properties
[elogind.git] / src / udev / collect / collect.c
index 076fe479e22720758879b2c16628aa9558c31e9c..4162c436b0e21ec4b3cb47c6b8b2dca0c378d2e8 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "libudev.h"
 #include "libudev-private.h"
+#include "macro.h"
 
 #define BUFSIZE                        16
 #define UDEV_ALARM_TIMEOUT        180
@@ -55,16 +56,12 @@ static int debug;
 /* This can increase dynamically */
 static size_t bufsize = BUFSIZE;
 
-static struct _mate *node_to_mate(struct udev_list_node *node)
+static inline struct _mate *node_to_mate(struct udev_list_node *node)
 {
-        char *mate;
-
-        mate = (char *)node;
-        mate -= offsetof(struct _mate, node);
-        return (struct _mate *)mate;
+        return container_of(node, struct _mate, node);
 }
 
-static void sig_alrm(int signo)
+_noreturn_ static void sig_alrm(int signo)
 {
         exit(4);
 }
@@ -144,7 +141,7 @@ static int checkout(int fd)
         len = bufsize >> 1;
         buf = calloc(1,bufsize + 1);
         if (!buf) {
-                fprintf(stderr, "Out of memory\n");
+                fprintf(stderr, "Out of memory.\n");
                 return -1;
         }
         memset(buf, ' ', bufsize);
@@ -405,7 +402,7 @@ int main(int argc, char **argv)
         if (debug)
                 fprintf(stderr, "Using checkpoint '%s'\n", checkpoint);
 
-        util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL);
+        util_strscpyl(tmpdir, sizeof(tmpdir), "/run/udev/collect", NULL);
         fd = prepare(tmpdir, checkpoint);
         if (fd < 0) {
                 ret = 3;