linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhilong Liu <zlliu@suse.com>
To: Jes.Sorensen@gmail.com
Cc: linux-raid@vger.kernel.org, Zhilong Liu <zlliu@suse.com>
Subject: [PATCH 3/4] mdadm/Create:declaring an existing struct within same function
Date: Sat,  1 Apr 2017 20:51:44 +0800	[thread overview]
Message-ID: <20170401125145.14440-4-zlliu@suse.com> (raw)
In-Reply-To: <20170401125145.14440-1-zlliu@suse.com>

Create:declaring 'struct stat stb' twice within the same
function, rename stb as stb2 when declares 'struct stat'
at the second time.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
 Create.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Create.c b/Create.c
index e43c1d6..619e68a 100644
--- a/Create.c
+++ b/Create.c
@@ -865,7 +865,7 @@ int Create(struct supertype *st, char *mddev,
 		for (dnum=0, raid_disk_num=0, dv = devlist ; dv ;
 		     dv=(dv->next)?(dv->next):moved_disk, dnum++) {
 			int fd;
-			struct stat stb;
+			struct stat stb2;
 			struct mdinfo *inf = &infos[dnum];
 
 			if (dnum >= total_slots)
@@ -921,9 +921,9 @@ int Create(struct supertype *st, char *mddev,
 							dv->devname);
 						goto abort_locked;
 					}
-					fstat(fd, &stb);
-					inf->disk.major = major(stb.st_rdev);
-					inf->disk.minor = minor(stb.st_rdev);
+					fstat(fd, &stb2);
+					inf->disk.major = major(stb2.st_rdev);
+					inf->disk.minor = minor(stb2.st_rdev);
 				}
 				if (fd >= 0)
 					remove_partitions(fd);
@@ -944,8 +944,8 @@ int Create(struct supertype *st, char *mddev,
 
 				if (!have_container) {
 					/* getinfo_super might have lost these ... */
-					inf->disk.major = major(stb.st_rdev);
-					inf->disk.minor = minor(stb.st_rdev);
+					inf->disk.major = major(stb2.st_rdev);
+					inf->disk.minor = minor(stb2.st_rdev);
 				}
 				break;
 			case 2:
-- 
2.10.2


  parent reply	other threads:[~2017-04-01 12:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01 12:51 [PATCH 0/4] integrated stat and fstat into utility functions Zhilong Liu
2017-04-01 12:51 ` [PATCH 1/4] mdadm/util:integrate stat operations into one utility Zhilong Liu
2017-04-05 15:42   ` jes.sorensen
2017-04-14 10:14     ` Liu Zhilong
2017-04-14 15:20       ` Jes Sorensen
2017-04-17  7:08         ` Liu Zhilong
2017-04-17  7:18           ` Zhilong Liu
2017-04-20 16:42           ` Jes Sorensen
2017-04-01 12:51 ` [PATCH 2/4] mdadm/util:integrate fstat operations into one utility function Zhilong Liu
2017-04-05 15:43   ` jes.sorensen
2017-04-01 12:51 ` Zhilong Liu [this message]
2017-04-05 15:47   ` [PATCH 3/4] mdadm/Create:declaring an existing struct within same function jes.sorensen
2017-04-01 12:51 ` [PATCH 4/4] mdadm/Monitor:check the block device when use waitclean parameter Zhilong Liu
2017-04-14 12:31 ` [PATCH 0/4] integrated stat and fstat into utility functions Paul Menzel
2017-04-17  2:23   ` Zhilong Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170401125145.14440-4-zlliu@suse.com \
    --to=zlliu@suse.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).