When trying to open a buffer device file from a list of possible
paths, make the process stop at first file that exists even if it
has no permissions to open that file. This will prevent from
opening a wrong or fallback buffer.
Change-Id: Iad6cc0154fc173066456395bfb1863ff4ccf27d9
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
if ((ret = open(dev_path, open_flags)) >= 0) {
*fd = ret;
return 1;
+ } else if (errno != ENOENT) {
+ return -errno;
}
dev_path = strtok_r(NULL, ":", &saveptr);