Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b202fd96 authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Added an failure log message when the fwdlock engine fails to open a given file."

parents 19a07d97 86233903
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
 * limitations under the License.
 */

#include <utils/Log.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
@@ -107,6 +108,7 @@ static int FwdLockFile_AcquireSession(int fileDesc) {
        }
        pthread_mutex_unlock(&sessionAcquisitionMutex);
        if (i == MAX_NUM_SESSIONS) {
            ALOGE("Too many sessions opened at the same time");
            errno = ENFILE;
        }
    }
@@ -293,7 +295,12 @@ int FwdLockFile_attach(int fileDesc) {

int FwdLockFile_open(const char *pFilename) {
    int fileDesc = open(pFilename, O_RDONLY);
    if (fileDesc >= 0 && FwdLockFile_attach(fileDesc) < 0) {
    if (fileDesc < 0) {
        ALOGE("failed to open file '%s': %s", pFilename, strerror(errno));
        return fileDesc;
    }

    if (FwdLockFile_attach(fileDesc) < 0) {
        (void)close(fileDesc);
        fileDesc = -1;
    }