Skip to content

Commit

Permalink
fix(install): rectify unused function args in log.c
Browse files Browse the repository at this point in the history
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
  • Loading branch information
sshedi authored and johannbg committed Aug 9, 2021
1 parent e2a6159 commit b5cf7ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/install/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand Down
3 changes: 3 additions & 0 deletions src/install/macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,7 @@ do { \
_ptr_; \
})

/* Use to suppress unused variable/function arg warning */
#define UNUSED(var) ((void)var)

#include "log.h"

0 comments on commit b5cf7ec

Please sign in to comment.