grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] util: Ignore return value for grub_util_mkdir() on all platf


From: Darren Kenny
Subject: [PATCH 1/2] util: Ignore return value for grub_util_mkdir() on all platforms
Date: Tue, 9 Aug 2022 13:29:04 +0000

Coverity signaled 2 issues where the return value of grub_util_mkdir()
was not being tested.

The Windows variant of this code defines the function as having no
return value (void), but the UNIX variants all are mapped using a macro
to the libc mkdir() function, which returns an int value.

To be consistent, the mapping should cast to void to for these too.

Fixes: CID 73583
Fixes: CID 73617

Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
---
 include/grub/osdep/hostfile_aros.h | 2 +-
 include/grub/osdep/hostfile_unix.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/grub/osdep/hostfile_aros.h 
b/include/grub/osdep/hostfile_aros.h
index 161fbb7bdfd6..bd2c62c9a716 100644
--- a/include/grub/osdep/hostfile_aros.h
+++ b/include/grub/osdep/hostfile_aros.h
@@ -74,7 +74,7 @@ grub_util_readlink (const char *name, char *buf, size_t 
bufsize)
   return readlink(name, buf, bufsize);
 }
 
-#define grub_util_mkdir(a) mkdir ((a), 0755)
+#define grub_util_mkdir(a) (void)mkdir ((a), 0755)
 
 struct grub_util_fd
 {
diff --git a/include/grub/osdep/hostfile_unix.h 
b/include/grub/osdep/hostfile_unix.h
index 17cd3aa8b304..e6f082f259cb 100644
--- a/include/grub/osdep/hostfile_unix.h
+++ b/include/grub/osdep/hostfile_unix.h
@@ -77,7 +77,7 @@ grub_util_readlink (const char *name, char *buf, size_t 
bufsize)
   return readlink(name, buf, bufsize);
 }
 
-#define grub_util_mkdir(a) mkdir ((a), 0755)
+#define grub_util_mkdir(a) (void)mkdir ((a), 0755)
 
 #if defined (__NetBSD__)
 /* NetBSD uses /boot for its boot block.  */
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]