]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/udev/udev-builtin-blkid.c
Merge pull request #16316 from yuwata/backlight-use-actual-brightness
[thirdparty/systemd.git] / src / udev / udev-builtin-blkid.c
index efbb0732f1a32ed88d63da2faeaf0025800c7b64..1df41dab36bc34d9a21cbb491a9e5cd5cbd141f8 100644 (file)
@@ -5,13 +5,11 @@
  * Copyright © 2011 Karel Zak <kzak@redhat.com>
  */
 
-#include <blkid.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <getopt.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <sys/stat.h>
 
 #include "sd-id128.h"
@@ -19,7 +17,8 @@
 #include "alloc-util.h"
 #include "blkid-util.h"
 #include "device-util.h"
-#include "efivars.h"
+#include "efi-loader.h"
+#include "errno-util.h"
 #include "fd-util.h"
 #include "gpt.h"
 #include "parse-util.h"
@@ -113,7 +112,7 @@ static int find_gpt_root(sd_device *dev, blkid_probe pr, bool test) {
         errno = 0;
         pl = blkid_probe_get_partitions(pr);
         if (!pl)
-                return -errno ?: -ENOMEM;
+                return errno_or_else(ENOMEM);
 
         nvals = blkid_partlist_numof_partitions(pl);
         for (i = 0; i < nvals; i++) {
@@ -265,7 +264,7 @@ static int builtin_blkid(sd_device *dev, int argc, char *argv[], bool test) {
         if (r < 0)
                 return log_device_debug_errno(dev, r, "Failed to get device name: %m");
 
-        fd = open(devnode, O_RDONLY|O_CLOEXEC);
+        fd = open(devnode, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
         if (fd < 0)
                 return log_device_debug_errno(dev, errno, "Failed to open block device %s: %m", devnode);