Skip to content

Commit b5cf7ec

Browse files
sshedijohannbg
authored andcommitted
fix(install): rectify unused function args in log.c
Signed-off-by: Shreenidhi Shedi <[email protected]>
1 parent e2a6159 commit b5cf7ec

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/install/log.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ void log_set_facility(int facility)
103103

104104
static int write_to_console(int level, const char *file, unsigned int line, const char *func, const char *buffer)
105105
{
106-
107106
struct iovec iovec[5];
108107
unsigned int n = 0;
109108

109+
// might be useful going ahead
110+
UNUSED(level);
111+
110112
if (console_fd < 0)
111113
return 0;
112114

@@ -115,8 +117,8 @@ static int write_to_console(int level, const char *file, unsigned int line, cons
115117
IOVEC_SET_STRING(iovec[n++], "dracut-install: ");
116118

117119
if (show_location) {
118-
char location[64];
119-
if (snprintf(location, sizeof(location), "(%s:%u) ", file, line) <= 0)
120+
char location[LINE_MAX] = {0};
121+
if (snprintf(location, sizeof(location), "(%s:%s:%u) ", file, func, line) <= 0)
120122
return -errno;
121123
IOVEC_SET_STRING(iovec[n++], location);
122124
}

src/install/macro.h

+3
Original file line numberDiff line numberDiff line change
@@ -293,4 +293,7 @@ do { \
293293
_ptr_; \
294294
})
295295

296+
/* Use to suppress unused variable/function arg warning */
297+
#define UNUSED(var) ((void)var)
298+
296299
#include "log.h"

0 commit comments

Comments
 (0)