chiark / gitweb /
Merge branch 'master' of gregkh@master.kernel.org:/pub/scm/linux/hotplug/udev
[elogind.git] / udeveventrecorder.c
index af7ea7c15c3471fb7389db1e57c93f5036fec034..422cf88ff0029c9483ce7d4c09c8c4abdc6f2910 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * udeveventrecorder.c
  *
- * Userspace devfs
- *
- * Copyright (C) 2004, 2005 Olaf Hering <olh@suse.de>
+ * Copyright (C) 2004-2005 SuSE Linux Products GmbH
+ * Author:
+ *     Olaf Hering <olh@suse.de>
  *
  *     This program is free software; you can redistribute it and/or modify it
  *     under the terms of the GNU General Public License as published by the
 #define BUFSIZE 12345
 #define FNSIZE  123
 
-static int log = 0;
+static int udev_log = 0;
 
 #ifdef USE_LOG
 void log_message (int priority, const char *format, ...)
 {
        va_list args;
 
-       if (priority > log)
+       if (priority > udev_log)
                return;
 
        va_start(args, format);
@@ -63,11 +63,11 @@ int main(int argc, char **argv, char **envp)
        const char *env;
 
        if (stat("/events", &sb) || !(S_ISDIR(sb.st_mode)))
-               return 1;
+               return 0;
 
        env = getenv("UDEV_LOG");
        if (env)
-               log = log_priority(env);
+               udev_log = log_priority(env);
 
        logging_init("udeveventrecorder");
        dbg("version %s", UDEV_VERSION);
@@ -84,7 +84,7 @@ int main(int argc, char **argv, char **envp)
 
        snprintf(buf, FNSIZE, "/events/debug.%05lu.%s.%s.%u", seq, argv[1], a ? a : "", getpid());
        if ((fd = open(buf, O_CREAT | O_WRONLY | O_TRUNC, 0644)) < 0) {
-               err("error creating '%s'", buf);
+               err("error creating '%s': %s", buf, strerror(errno));
                goto error;
        }
        free(buf);