return -1;
}
- fcntl(new_fd, F_SETFD, flags|FD_CLOEXEC);
+ if (fcntl(new_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
+ TBM_LOG_E("failed to set fd\n");
+ close(new_fd);
+ return -1;
+ }
TBM_LOG_I("Return TBM_FD: %d\n", new_fd);
fd = open(tbm_drm_auth_srv->device_name, O_RDWR | O_CLOEXEC);
if (fd == -1 && errno == EINVAL) {
fd = open(tbm_drm_auth_srv->device_name, O_RDWR);
- if (fd != -1)
- fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+ if (fd != -1) {
+ if (fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC) == -1) {
+ TBM_LOG_E("failed to set fd\n");
+ goto fini;
+ }
+ }
}
if (fd < 0) {
return -1;
}
- fcntl(new_fd, F_SETFD, flags|FD_CLOEXEC);
+ if (fcntl(new_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
+ TBM_LOG_E("failed to set fd\n");
+ close(new_fd);
+ return -1;
+ }
TBM_LOG_I("Return MASTER_FD: %d\n", new_fd);