提交 ac21e39f 编写于 作者: M Michal Privoznik

virpidfile: Set correct retval in virPidFileReadPath()

The virPidFileReadPath() function is supposed to return 0 on
success or a negative value on failure. But the negative value
has a special meaning - it's negated errno. Therefore, when
converting string to int we shouldn't return -1 which translates
to EPERM. Returning EINVAL looks closer to the truth.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 a570dc67
......@@ -130,7 +130,7 @@ int virPidFileReadPath(const char *path,
if (virStrToLong_ll(pidstr, &endptr, 10, &pid_value) < 0 ||
!(*endptr == '\0' || g_ascii_isspace(*endptr)) ||
(pid_t) pid_value != pid_value) {
rc = -1;
rc = -EINVAL;
goto cleanup;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册