shared: fix unused variable warning
authorFrank Binns <frank.binns@imgtec.com>
Wed, 24 Jun 2020 10:07:42 +0000 (11:07 +0100)
committerFrank Binns <frank.binns@imgtec.com>
Wed, 24 Jun 2020 10:11:31 +0000 (11:11 +0100)
Fix the following build warning by moving the 'seals' declaration inside the
HAVE_MEMFD_CREATE guard:

  ../shared/os-compatibility.c: In function ‘os_ro_anonymous_file_get_fd’:
  ../shared/os-compatibility.c:341:6: warning: unused variable ‘seals’ [-Wunused-variable]
    int seals, fd;
        ^

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
shared/os-compatibility.c

index 2e12b7cc362618a6ce9330f093c0794d864eebf7..f761080707a3ecf6771370e6ec147bc437a4ae0c 100644 (file)
@@ -338,10 +338,10 @@ os_ro_anonymous_file_get_fd(struct ro_anonymous_file *file,
                            enum ro_anonymous_file_mapmode mapmode)
 {
        void *src, *dst;
-       int seals, fd;
+       int fd;
 
 #ifdef HAVE_MEMFD_CREATE
-       seals = fcntl(file->fd, F_GET_SEALS);
+       int seals = fcntl(file->fd, F_GET_SEALS);
 
        /* file was sealed for read-only and we don't have to support MAP_SHARED
         * so we can simply pass the memfd fd