* 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"
#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"
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++) {
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);