libvideorender: CB1 fix crash on executeCmd [1/1]
PD#TV-111307
Problem:
when DTV changes channel fast, sometimes
popen return null, it causes fget crash with null point
Solution:
invoking fget after popen success
Verify:
AH212
Change-Id: I56fac937c337c5666f3f02982ab25f28f7d39ad8
Signed-off-by: fei.deng <fei.deng@amlogic.com>
diff --git a/westeros/wstclient_wayland.cpp b/westeros/wstclient_wayland.cpp
index 5ffd3d2..d77f6c5 100644
--- a/westeros/wstclient_wayland.cpp
+++ b/westeros/wstclient_wayland.cpp
@@ -446,6 +446,8 @@
ERROR(mLogCategory, "wayland connect rlib-display fail");
return ERROR_OPEN_FAIL;
}
+ setenv("XDG_RUNTIME_DIR",xdgEnv,0);
+ setenv("WAYLAND_DISPLAY",displayName,0);
INFO(mLogCategory,"wayland connected to rlib-display");
}
@@ -1065,8 +1067,10 @@
void WstClientWayland::executeCmd(const char *cmd) {
INFO(mLogCategory,"%s", cmd);
FILE* pFile = popen(cmd, "r");
- char buf[128];
- char* retStr = fgets(buf, sizeof(buf), pFile);
- INFO(mLogCategory,"ret= %s", retStr);
- pclose(pFile);
+ if (pFile) {
+ char buf[128];
+ char* retStr = fgets(buf, sizeof(buf), pFile);
+ INFO(mLogCategory,"ret= %s", retStr);
+ pclose(pFile);
+ }
}
\ No newline at end of file