logger: stop at first found buffer file even when unable to open it 45/182845/2
authorMaciej Slodczyk <m.slodczyk2@partner.samsung.com>
Thu, 28 Jun 2018 09:15:34 +0000 (11:15 +0200)
committerMaciej Slodczyk <m.slodczyk2@partner.samsung.com>
Fri, 29 Jun 2018 08:13:11 +0000 (08:13 +0000)
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>
src/shared/logcommon.c

index 5dda5cd..54e7c7f 100644 (file)
@@ -461,6 +461,8 @@ int logger_open_buffer(int buf_id, const char *const config_list, int open_flags
                if ((ret = open(dev_path, open_flags)) >= 0) {
                        *fd = ret;
                        return 1;
+               } else if (errno != ENOENT) {
+                       return -errno;
                }
 
                dev_path = strtok_r(NULL, ":", &saveptr);