{
int new_fd, flags, fd = -1;
-#if 1 /* TODO: can't remove below at this time. This code SHOULD be removed later */
- const char *value = (const char*)getenv("TDM_DRM_MASTER_FD");
- if (value) {
- char *end;
- const long int sl = strtol(value, &end, 10);
-
- if (end == value) {
- TBM_ERR("%s: not a decimal number\n", value);
- return -1;
- } else if (*end != '\0') {
- TBM_ERR("%s: extra characters at end of input: %s\n", value, end);
- return -1;
- } else if ((sl == LONG_MIN || sl == LONG_MAX) && errno == ERANGE) {
- TBM_ERR("%s out of range of type long\n", value);
- return -1;
- } else if (sl >= INT_MAX) {
- TBM_ERR("%ld greater than INT_MAX\n", sl);
- return -1;
- } else if (sl <= INT_MIN) {
- TBM_ERR("%ld less than INT_MIN\n", sl);
- return -1;
- } else {
- int fd_max = tbm_bufmgr_get_fd_limit();
- fd = (int)sl;
- if (fd < 0 || fd > fd_max) {
- TBM_ERR("%d out of fd range\n", fd);
- return -1;
- }
- }
- } else
-#endif
fd = tbm_drm_master_fd;
-
if (fd == -1) {
TBM_INFO("no presetted TBM DRM MASTER FD");
return -1;