]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(install): rectify unused function args in log.c
authorShreenidhi Shedi <sshedi@vmware.com>
Sun, 8 Aug 2021 18:51:10 +0000 (00:21 +0530)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Mon, 9 Aug 2021 17:11:22 +0000 (17:11 +0000)
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
src/install/log.c
src/install/macro.h

index 303eece86e610b7e0e19013eb9a65f14d0ba71dc..3f77b5a5c15ba682cae59b83463e242ee5b03a53 100644 (file)
@@ -103,10 +103,12 @@ void log_set_facility(int facility)
 
 static int write_to_console(int level, const char *file, unsigned int line, const char *func, const char *buffer)
 {
-
         struct iovec iovec[5];
         unsigned int n = 0;
 
+        // might be useful going ahead
+        UNUSED(level);
+
         if (console_fd < 0)
                 return 0;
 
@@ -115,8 +117,8 @@ static int write_to_console(int level, const char *file, unsigned int line, cons
         IOVEC_SET_STRING(iovec[n++], "dracut-install: ");
 
         if (show_location) {
-                char location[64];
-                if (snprintf(location, sizeof(location), "(%s:%u) ", file, line) <= 0)
+                char location[LINE_MAX] = {0};
+                if (snprintf(location, sizeof(location), "(%s:%s:%u) ", file, func, line) <= 0)
                         return -errno;
                 IOVEC_SET_STRING(iovec[n++], location);
         }
index a6346c9db86d8865f16a0055640e96ebb7d75efb..003cf80ac546b79f58b32712a483f1f43f95bc8d 100644 (file)
@@ -293,4 +293,7 @@ do {                                                                    \
                 _ptr_;                          \
         })
 
+/* Use to suppress unused variable/function arg warning */
+#define UNUSED(var)   ((void)var)
+
 #include "log.h"