57 lines
1.7 KiB
Diff
57 lines
1.7 KiB
Diff
From 8a0b4b2183e05be4c92612b0a82ed64617e6a742 Mon Sep 17 00:00:00 2001
|
|
From: Andrew Price <anprice@redhat.com>
|
|
Date: Tue, 9 Jun 2020 15:24:28 +0100
|
|
Subject: [PATCH] gfs2_jadd: Fix static analysis warnings
|
|
|
|
Fix these warnings:
|
|
|
|
gfs2/mkfs/main_jadd.c:264:8: warning: Although the value stored to
|
|
'error' is used in the enclosing expression, the value is never actually
|
|
read from 'error'
|
|
gfs2/mkfs/main_jadd.c:514:15: warning: Assigned value is garbage or
|
|
undefined
|
|
|
|
Signed-off-by: Andrew Price <anprice@redhat.com>
|
|
---
|
|
gfs2/mkfs/main_jadd.c | 9 +++++----
|
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
|
|
index ea89c96b..03134a61 100644
|
|
--- a/gfs2/mkfs/main_jadd.c
|
|
+++ b/gfs2/mkfs/main_jadd.c
|
|
@@ -241,7 +241,7 @@ static void print_results(struct jadd_opts *opts)
|
|
static int create_new_inode(struct jadd_opts *opts, uint64_t *addr)
|
|
{
|
|
char *name = opts->new_inode;
|
|
- int fd, error = 0;
|
|
+ int fd;
|
|
|
|
for (;;) {
|
|
fd = open(name, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, 0600);
|
|
@@ -261,9 +261,10 @@ static int create_new_inode(struct jadd_opts *opts, uint64_t *addr)
|
|
if (addr != NULL) {
|
|
struct stat st;
|
|
|
|
- if ((error = fstat(fd, &st))) {
|
|
+ if (fstat(fd, &st) == -1) {
|
|
perror("fstat");
|
|
- return close(fd);
|
|
+ close(fd);
|
|
+ return -1;
|
|
}
|
|
*addr = st.st_ino;
|
|
}
|
|
@@ -481,7 +482,7 @@ static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
|
|
unsigned int x, blocks =
|
|
sdp->jsize << (20 - sdp->sd_sb.sb_bsize_shift);
|
|
struct gfs2_log_header lh;
|
|
- uint64_t seq = RANDOM(blocks), addr;
|
|
+ uint64_t seq = RANDOM(blocks), addr = 0;
|
|
off_t off = 0;
|
|
|
|
if ((fd = create_new_inode(opts, &addr)) < 0)
|
|
--
|
|
2.33.0
|
|
|