提交 4b15aad0 编写于 作者: M Matthias Bolte

openvz: Handle getline failures in openvzReadConfigParam properly

The regression fix in 3aab7f2d altered the error handling.
getline returns -1 on failure to read a line (including EOF). The
original openvzReadConfigParam function using openvz_readline only
treated EOF as not-found. The current getline version treats all
getline failures as not-found.

This patch fixes this and distinguishes EOF from other getline
failures.
上级 ad962bcd
......@@ -659,7 +659,12 @@ openvzReadConfigParam(const char *conf_file, const char *param, char **value)
return -1;
VIR_FREE(*value);
while (getline(&line, &line_size, fp) >= 0) {
while (1) {
if (getline(&line, &line_size, fp) < 0) {
err = !feof(fp);
break;
}
if (! STREQLEN(line, param, strlen(param)))
continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册