Skip to content

Commit

Permalink
blkid: fix -Wunused-but-set-variable warning in blkid_read_cache()
Browse files Browse the repository at this point in the history
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
tytso committed Mar 28, 2024
1 parent 2e42f7b commit 33ee0c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/blkid/blkidP.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ extern char *blkid_strndup(const char *s, const int length);
#include <stdio.h>
extern int blkid_debug_mask;
#define DBG(m,x) if ((m) & blkid_debug_mask) x;
#define INC_LINENO lineno++
#else
#define DBG(m,x)
#define INC_LINENO
#endif

#ifdef CONFIG_BLKID_DEBUG
Expand Down
9 changes: 6 additions & 3 deletions lib/blkid/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ void blkid_read_cache(blkid_cache cache)
{
FILE *file;
char buf[4096];
int fd, lineno = 0;
int fd;
#ifdef CONFIG_BLKID_DEBUG
int lineno = 0;
#endif
struct stat st;

if (!cache)
Expand Down Expand Up @@ -414,15 +417,15 @@ void blkid_read_cache(blkid_cache cache)
blkid_dev dev;
unsigned int end;

lineno++;
INC_LINENO;
if (buf[0] == 0)
continue;
end = strlen(buf) - 1;
/* Continue reading next line if it ends with a backslash */
while (buf[end] == '\\' && end < sizeof(buf) - 2 &&
fgets(buf + end, sizeof(buf) - end, file)) {
end = strlen(buf) - 1;
lineno++;
INC_LINENO;
}

if (blkid_parse_line(cache, &dev, buf) < 0) {
Expand Down

0 comments on commit 33ee0c8

Please sign in to comment.