chiark / gitweb /
udev: add missing newline when writing to /dev/kmsg
[elogind.git] / src / udev / ata_id / ata_id.c
index d2fe9172178582304b347f8d9e289a1ec735f3be..e1069b5c6e273746edd7baec999f7106b5ad3dc0 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "libudev.h"
 #include "libudev-private.h"
+#include "log.h"
 
 #define COMMAND_TIMEOUT_MSEC (30 * 1000)
 
@@ -359,7 +360,6 @@ static int disk_identify(struct udev *udev,
         int is_packet_device;
 
         /* init results */
-        ret = -1;
         memset(out_identify, '\0', 512);
         is_packet_device = 0;
 
@@ -462,7 +462,7 @@ int main(int argc, char *argv[])
         if (udev == NULL)
                 goto exit;
 
-        udev_log_init("ata_id");
+        log_open();
         udev_set_log_fn(udev, log_fn);
 
         while (1) {
@@ -486,14 +486,14 @@ int main(int argc, char *argv[])
 
         node = argv[optind];
         if (node == NULL) {
-                err(udev, "no node specified\n");
+                log_error("no node specified\n");
                 rc = 1;
                 goto exit;
         }
 
         fd = open(node, O_RDONLY|O_NONBLOCK);
         if (fd < 0) {
-                err(udev, "unable to open '%s'\n", node);
+                log_error("unable to open '%s'\n", node);
                 rc = 1;
                 goto exit;
         }
@@ -504,7 +504,7 @@ int main(int argc, char *argv[])
                  * use and copy it into the hd_driveid struct for convenience
                  */
                 disk_identify_fixup_string(identify,  10, 20); /* serial */
-                disk_identify_fixup_string(identify,  23,  6); /* fwrev */
+                disk_identify_fixup_string(identify,  23,  8); /* fwrev */
                 disk_identify_fixup_string(identify,  27, 40); /* model */
                 disk_identify_fixup_uint16(identify,  0);      /* configuration */
                 disk_identify_fixup_uint16(identify,  75);     /* queue depth */
@@ -525,7 +525,7 @@ int main(int argc, char *argv[])
         } else {
                 /* If this fails, then try HDIO_GET_IDENTITY */
                 if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) {
-                        info(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node);
+                        log_info("HDIO_GET_IDENTITY failed for '%s': %m\n", node);
                         rc = 2;
                         goto close;
                 }
@@ -709,6 +709,6 @@ close:
         close(fd);
 exit:
         udev_unref(udev);
-        udev_log_close();
+        log_close();
         return rc;
 }