summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-06-04 16:21:19 +0200
committerKay Sievers <kay@vrfy.org>2014-06-04 16:28:03 +0200
commit02ba8fb3357daf57f6120ac512fb464a4c623419 (patch)
tree5d76a25df836579105a607846056557fad8462ff /src
parent811ba7a0e292eda0f2f470613cc28a97bda7ee66 (diff)
udev: guard REREADPT by exclusive lock instead of O_EXCL
Diffstat (limited to 'src')
-rw-r--r--src/udev/udevd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 81e3f69a3a..0f3f3f087a 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -755,9 +755,12 @@ static int synthesize_change(struct udev_device *dev) {
* partition table is found, and we will not get an event for
* the disk.
*/
- fd = open(udev_device_get_devnode(dev), O_RDONLY|O_EXCL|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
+ fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
if (fd >= 0) {
- r = ioctl(fd, BLKRRPART, 0);
+ r = flock(fd, LOCK_EX|LOCK_NB);
+ if (r >= 0)
+ r = ioctl(fd, BLKRRPART, 0);
+
close(fd);
if (r >= 0)
part_table_read = true;