mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
device: Hack around EPERM issue
Opening the lock files fails on one of my boards if the files exists and are owned by someone else, if O_CREAT is set. This doesn't make sense, but hack around it for now by first creating the file if it's not there, ignoring any errors and then just opening it O_RDONLY. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
6
device.c
6
device.c
@@ -64,7 +64,11 @@ static void device_lock(struct device *device)
|
||||
if (n >= sizeof(lock))
|
||||
errx(1, "failed to build lockfile path");
|
||||
|
||||
fd = open(lock, O_RDONLY | O_CREAT | O_CLOEXEC, 0666);
|
||||
fd = open(lock, O_RDONLY | O_CREAT, 0666);
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
|
||||
fd = open(lock, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
err(1, "failed to open lockfile %s", lock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user