Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
util-linux-systemd.17283
util-linux-libblkid-cdrom-autoclose-1.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-libblkid-cdrom-autoclose-1.patch of Package util-linux-systemd.17283
From 39f5af25982d8b0244000e92a9d0e0e6557d0e17 Mon Sep 17 00:00:00 2001 From: Michal Suchanek <msuchanek@suse.de> Date: Mon, 4 Nov 2019 21:23:15 +0100 Subject: [PATCH] libblkid: open device in nonblock mode. When autoclose is set (kernel default but many distributions reverse the setting) opening a CD-rom device causes the tray to close. The function of blkid is to report the current state of the device and not to change it. Hence it should use O_NONBLOCK when opening the device to avoid closing a CD-rom tray. blkid is used liberally in scripts so it can potentially interfere with the user operating the CD-rom hardware. [kzak@redhat.com: add O_NONBLOCK also to: - wipefs - blkid_new_probe_from_filename() - blkid_evaluate_tag()] Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com> --- libblkid/src/evaluate.c | 2 +- libblkid/src/probe.c | 2 +- libblkid/src/verify.c | 2 +- misc-utils/blkid.c | 2 +- misc-utils/wipefs.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libblkid/src/evaluate.c b/libblkid/src/evaluate.c index 51e5b058d..8ba8bd5f3 100644 --- a/libblkid/src/evaluate.c +++ b/libblkid/src/evaluate.c @@ -70,7 +70,7 @@ static int verify_tag(const char *devname, const char *name, const char *value) blkid_probe_enable_partitions(pr, TRUE); blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); - fd = open(devname, O_RDONLY|O_CLOEXEC); + fd = open(devname, O_RDONLY|O_CLOEXEC|O_NONBLOCK); if (fd < 0) { errsv = errno; goto done; diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index 790168c16..f6dd5573d 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -203,7 +203,7 @@ blkid_probe blkid_new_probe_from_filename(const char *filename) int fd; blkid_probe pr = NULL; - fd = open(filename, O_RDONLY|O_CLOEXEC); + fd = open(filename, O_RDONLY|O_CLOEXEC|O_NONBLOCK); if (fd < 0) return NULL; diff --git a/libblkid/src/verify.c b/libblkid/src/verify.c index a78c9f8f2..4bda3fd40 100644 --- a/libblkid/src/verify.c +++ b/libblkid/src/verify.c @@ -126,7 +126,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) } } - fd = open(dev->bid_name, O_RDONLY|O_CLOEXEC); + fd = open(dev->bid_name, O_RDONLY|O_CLOEXEC|O_NONBLOCK); if (fd < 0) { DBG(PROBE, ul_debug("blkid_verify: error %m (%d) while " "opening %s", errno, diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index f2583d2b8..0df9f6b6f 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -499,7 +499,7 @@ static int lowprobe_device(blkid_probe pr, const char *devname, int rc = 0; static int first = 1; - fd = open(devname, O_RDONLY|O_CLOEXEC); + fd = open(devname, O_RDONLY|O_CLOEXEC|O_NONBLOCK); if (fd < 0) { warn(_("error: %s"), devname); return BLKID_EXIT_NOTFOUND; diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c index be728279b..313ddc36e 100644 --- a/misc-utils/wipefs.c +++ b/misc-utils/wipefs.c @@ -386,7 +386,7 @@ new_probe(const char *devname, int mode) return NULL; if (mode) { - int fd = open(devname, mode); + int fd = open(devname, mode | O_NONBLOCK); if (fd < 0) goto error; -- 2.28.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor