ecore-drm: Trap for failure to dup stdin

Summary: If we fail to duplicate stdin, we should write out an error
and exit appropriately.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-02-02 11:59:27 -05:00
parent 559b7d7ee6
commit 37d21a4729
1 changed files with 8 additions and 1 deletions

View File

@ -152,7 +152,14 @@ ecore_drm_tty_open(Ecore_Drm_Device *dev, const char *name)
if ((env = getenv("ECORE_DRM_TTY"))) if ((env = getenv("ECORE_DRM_TTY")))
snprintf(tty, sizeof(tty), "%s", env); snprintf(tty, sizeof(tty), "%s", env);
else else
dev->tty.fd = dup(STDIN_FILENO); {
dev->tty.fd = dup(STDIN_FILENO);
if (dev->tty.fd < 0)
{
ERR("Could not dup stdin: %m");
return EINA_FALSE;
}
}
} }
else else
snprintf(tty, sizeof(tty), "%s", name); snprintf(tty, sizeof(tty), "%s", name);