lxcProcReadMeminfo: Rename @fd to @fp
In lxcProcReadMeminfo() there's a variable named @fd which would suggest it's type of int, but in fact it's type of FILE *. Rename it to @fp to avoid confusion. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c7171f937e
commit
d68a8b2109
@ -148,7 +148,7 @@ lxcProcReadMeminfo(char *hostpath,
|
|||||||
off_t offset)
|
off_t offset)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
FILE *fd = NULL;
|
FILE *fp = NULL;
|
||||||
g_autofree char *line = NULL;
|
g_autofree char *line = NULL;
|
||||||
size_t n;
|
size_t n;
|
||||||
struct virLXCMeminfo meminfo;
|
struct virLXCMeminfo meminfo;
|
||||||
@ -160,21 +160,21 @@ lxcProcReadMeminfo(char *hostpath,
|
|||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = fopen(hostpath, "r");
|
fp = fopen(hostpath, "r");
|
||||||
if (fd == NULL) {
|
if (fp == NULL) {
|
||||||
virReportSystemError(errno, _("Cannot open %s"), hostpath);
|
virReportSystemError(errno, _("Cannot open %s"), hostpath);
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fseek(fd, offset, SEEK_SET) < 0) {
|
if (fseek(fp, offset, SEEK_SET) < 0) {
|
||||||
virReportSystemError(errno, "%s", _("fseek failed"));
|
virReportSystemError(errno, "%s", _("fseek failed"));
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = -1;
|
res = -1;
|
||||||
while (getline(&line, &n, fd) > 0) {
|
while (getline(&line, &n, fp) > 0) {
|
||||||
char *ptr = strchr(line, ':');
|
char *ptr = strchr(line, ':');
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
continue;
|
continue;
|
||||||
@ -251,7 +251,7 @@ lxcProcReadMeminfo(char *hostpath,
|
|||||||
memcpy(buf, virBufferCurrentContent(new_meminfo), res);
|
memcpy(buf, virBufferCurrentContent(new_meminfo), res);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FORCE_FCLOSE(fd);
|
VIR_FORCE_FCLOSE(fp);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user