Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
python-libmount
util-linux-libblkid-cdrom-autoclose-1.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-libblkid-cdrom-autoclose-1.patch of Package python-libmount
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(-) Index: util-linux-2.29.2/libblkid/src/evaluate.c =================================================================== --- util-linux-2.29.2.orig/libblkid/src/evaluate.c +++ util-linux-2.29.2/libblkid/src/evaluate.c @@ -70,7 +70,7 @@ static int verify_tag(const char *devnam 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; Index: util-linux-2.29.2/libblkid/src/probe.c =================================================================== --- util-linux-2.29.2.orig/libblkid/src/probe.c +++ util-linux-2.29.2/libblkid/src/probe.c @@ -214,7 +214,7 @@ blkid_probe blkid_new_probe_from_filenam int fd = -1; 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; Index: util-linux-2.29.2/libblkid/src/verify.c =================================================================== --- util-linux-2.29.2.orig/libblkid/src/verify.c +++ util-linux-2.29.2/libblkid/src/verify.c @@ -126,7 +126,7 @@ blkid_dev blkid_verify(blkid_cache cache } } - 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, Index: util-linux-2.29.2/misc-utils/blkid.c =================================================================== --- util-linux-2.29.2.orig/misc-utils/blkid.c +++ util-linux-2.29.2/misc-utils/blkid.c @@ -485,7 +485,7 @@ static int lowprobe_device(blkid_probe p 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) { fprintf(stderr, "error: %s: %m\n", devname); return BLKID_EXIT_NOTFOUND; Index: util-linux-2.29.2/misc-utils/wipefs.c =================================================================== --- util-linux-2.29.2.orig/misc-utils/wipefs.c +++ util-linux-2.29.2/misc-utils/wipefs.c @@ -236,7 +236,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;
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