chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
811ba7a
)
udev: guard REREADPT by exclusive lock instead of O_EXCL
author
Kay Sievers
<kay@vrfy.org>
Wed, 4 Jun 2014 14:21:19 +0000
(16:21 +0200)
committer
Kay Sievers
<kay@vrfy.org>
Wed, 4 Jun 2014 14:28:03 +0000
(16:28 +0200)
src/udev/udevd.c
patch
|
blob
|
history
diff --git
a/src/udev/udevd.c
b/src/udev/udevd.c
index 81e3f69a3a7cc3e9e59c47cd3efe87662af04f99..0f3f3f087a7a7616dec174d4b96ae857e4f5fbff 100644
(file)
--- 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.
*/
* 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) {
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;
close(fd);
if (r >= 0)
part_table_read = true;