[PATCH 09/17] lxcProcReadMeminfo: Rename @fd to @fp

Michal Privoznik mprivozn at redhat.com
Mon Mar 7 09:00:59 UTC 2022


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 at redhat.com>
---
 src/lxc/lxc_fuse.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
index 274702736f..9eff188d5f 100644
--- a/src/lxc/lxc_fuse.c
+++ b/src/lxc/lxc_fuse.c
@@ -148,7 +148,7 @@ lxcProcReadMeminfo(char *hostpath,
                    off_t offset)
 {
     int res;
-    FILE *fd = NULL;
+    FILE *fp = NULL;
     g_autofree char *line = NULL;
     size_t n;
     struct virLXCMeminfo meminfo;
@@ -160,21 +160,21 @@ lxcProcReadMeminfo(char *hostpath,
         return -errno;
     }
 
-    fd = fopen(hostpath, "r");
-    if (fd == NULL) {
+    fp = fopen(hostpath, "r");
+    if (fp == NULL) {
         virReportSystemError(errno, _("Cannot open %s"), hostpath);
         res = -errno;
         goto cleanup;
     }
 
-    if (fseek(fd, offset, SEEK_SET) < 0) {
+    if (fseek(fp, offset, SEEK_SET) < 0) {
         virReportSystemError(errno, "%s", _("fseek failed"));
         res = -errno;
         goto cleanup;
     }
 
     res = -1;
-    while (getline(&line, &n, fd) > 0) {
+    while (getline(&line, &n, fp) > 0) {
         char *ptr = strchr(line, ':');
         if (!ptr)
             continue;
@@ -251,7 +251,7 @@ lxcProcReadMeminfo(char *hostpath,
     memcpy(buf, virBufferCurrentContent(new_meminfo), res);
 
  cleanup:
-    VIR_FORCE_FCLOSE(fd);
+    VIR_FORCE_FCLOSE(fp);
     return res;
 }
 
-- 
2.34.1



More information about the libvir-list mailing list