diff options
author | Kay Sievers <kay@vrfy.org> | 2014-06-04 16:21:19 +0200 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-06-07 08:44:41 -0400 |
commit | 0c693f06e35fab34bc5f0637a4b0a3a44fbb1ac1 (patch) | |
tree | 55622b6c4248db5925cecc2e05c5ac3cc6ab63f5 | |
parent | eb666fd898ed70201552d3d60bac964a896a4d40 (diff) |
udev: guard REREADPT by exclusive lock instead of O_EXCL
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | src/udev/udevd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index f0b91adab1..4e5d5df6b6 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; |