This function is also affected by getline conversion. But this
didn't result in a regression in general, because the difference
would only affect the behavior of the function when the line in
/proc/vz/vestat for the given vpsid wasn't found. Under normal
conditions this should not happen.
unsigned long long usertime, systime, nicetime;
int readvps = vpsid + 1; /* ensure readvps is initially different */
ssize_t ret;
+ int err = 0;
/* read statistic from /proc/vz/vestat.
sample:
/*search line with VEID=vpsid*/
while (1) {
ret = getline(&line, &line_size, fp);
- if (ret <= 0)
+ if (ret < 0) {
+ err = !feof(fp);
break;
+ }
if (sscanf (line, "%d %llu %llu %llu",
&readvps, &usertime, &nicetime, &systime) == 4
VIR_FREE(line);
VIR_FORCE_FCLOSE(fp);
- if (ret < 0)
+ if (err)
return -1;
if (readvps != vpsid) /*not found*/