提交 19cfd7e5 编写于 作者: P Peter Krempa

qemu: gpu: Sanitize error values in qemuVhostUserGPUGetPid

The caller doesn't care about the actual return value, so return -1
rather than errno.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 e22d844e
...@@ -61,7 +61,7 @@ qemuVhostUserGPUCreatePidFilename(const char *stateDir, ...@@ -61,7 +61,7 @@ qemuVhostUserGPUCreatePidFilename(const char *stateDir,
* @alias: video device alias * @alias: video device alias
* @pid: pointer to pid * @pid: pointer to pid
* *
* Return -errno upon error, or zero on successful reading of the pidfile. * Return -1 upon error, or zero on successful reading of the pidfile.
* If the PID was not still alive, zero will be returned, and @pid will be * If the PID was not still alive, zero will be returned, and @pid will be
* set to -1; * set to -1;
*/ */
...@@ -74,11 +74,13 @@ qemuVhostUserGPUGetPid(const char *binPath, ...@@ -74,11 +74,13 @@ qemuVhostUserGPUGetPid(const char *binPath,
{ {
g_autofree char *pidfile = NULL; g_autofree char *pidfile = NULL;
pidfile = qemuVhostUserGPUCreatePidFilename(stateDir, shortName, alias); if (!(pidfile = qemuVhostUserGPUCreatePidFilename(stateDir, shortName, alias)))
if (!pidfile) return -1;
return -ENOMEM;
if (virPidFileReadPathIfAlive(pidfile, pid, binPath) < 0)
return -1;
return virPidFileReadPathIfAlive(pidfile, pid, binPath); return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册