Skip to content

Commit b202fd9

Browse files
James DongAndroid (Google) Code Review
authored andcommitted
Merge "Added an failure log message when the fwdlock engine fails to open a given file."
2 parents 19a07d9 + 8623390 commit b202fd9

File tree

1 file changed

+8
-1
lines changed
  • drm/libdrmframework/plugins/forward-lock/internal-format/decoder

1 file changed

+8
-1
lines changed

drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

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

294296
int FwdLockFile_open(const char *pFilename) {
295297
int fileDesc = open(pFilename, O_RDONLY);
296-
if (fileDesc >= 0 && FwdLockFile_attach(fileDesc) < 0) {
298+
if (fileDesc < 0) {
299+
ALOGE("failed to open file '%s': %s", pFilename, strerror(errno));
300+
return fileDesc;
301+
}
302+
303+
if (FwdLockFile_attach(fileDesc) < 0) {
297304
(void)close(fileDesc);
298305
fileDesc = -1;
299306
}

0 commit comments

Comments
 (0)