discomfitor pushed a commit to branch efl-1.13. http://git.enlightenment.org/core/efl.git/commit/?id=141c27b85274d7fc499705a11024872c83a476d6
commit 141c27b85274d7fc499705a11024872c83a476d6 Author: Mike Blumenkrantz <zm...@osg.samsung.com> Date: Tue Feb 10 16:23:17 2015 -0500 ecore-drm should not use sscanf when getting logind vt this should be more robust for when something like "/dev/tty4" is passed @fix --- src/lib/ecore_drm/ecore_drm_logind.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lib/ecore_drm/ecore_drm_logind.c b/src/lib/ecore_drm/ecore_drm_logind.c index d4db3b9..f820756 100644 --- a/src/lib/ecore_drm/ecore_drm_logind.c +++ b/src/lib/ecore_drm/ecore_drm_logind.c @@ -1,4 +1,5 @@ #include "ecore_drm_private.h" +#include <ctype.h> #ifndef KDSKBMUTE # define KDSKBMUTE 0x4B51 @@ -11,7 +12,7 @@ static inline Eina_Bool _ecore_drm_logind_vt_get(Ecore_Drm_Device *dev) { int ret; - char *tty; + char *tty, *p; ret = sd_session_get_tty(dev->session, &tty); if (ret < 0) @@ -20,12 +21,18 @@ _ecore_drm_logind_vt_get(Ecore_Drm_Device *dev) return EINA_FALSE; } - ret = sscanf(tty, "tty%u", &dev->vt); + p = strchr(tty, 't'); + dev->vt = UINT_MAX; + if (p) + { + while (p[0] && (!isdigit(p[0]))) + p++; + if (p[0]) + dev->vt = strtoul(p, NULL, 10); + } free(tty); - if (ret != 1) return EINA_FALSE; - - return EINA_TRUE; + return dev->vt != UINT_MAX; } #endif --