aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2024-03-28 13:33:04 -0400
committerTheodore Ts'o <tytso@mit.edu>2024-03-28 13:33:04 -0400
commit33ee0c8b22d4fba069d0393847c84eba545ec01c (patch)
treeed88b87b6cf347ca3b32687c2b475aa441e4f85a
parent2e42f7bfd1d818899684b2f694be24970704e39a (diff)
downloade2fsprogs-33ee0c8b22d4fba069d0393847c84eba545ec01c.tar.gz
blkid: fix -Wunused-but-set-variable warning in blkid_read_cache()
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--lib/blkid/blkidP.h2
-rw-r--r--lib/blkid/read.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/blkid/blkidP.h b/lib/blkid/blkidP.h
index 68ea5724f..dad8bfbbf 100644
--- a/lib/blkid/blkidP.h
+++ b/lib/blkid/blkidP.h
@@ -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
diff --git a/lib/blkid/read.c b/lib/blkid/read.c
index b8948564c..ad4f44f0a 100644
--- a/lib/blkid/read.c
+++ b/lib/blkid/read.c
@@ -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)
@@ -414,7 +417,7 @@ 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;
@@ -422,7 +425,7 @@ void blkid_read_cache(blkid_cache cache)
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) {