Skip to contentSkip to conversation

master - command: avoid compiler warning

PATCH Alasdair Kergon 1 participant 1 message May 3, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a0f742542f5762c4c80e52eab31819ea5abdb94b
Commit:        a0f742542f5762c4c80e52eab31819ea5abdb94b
Parent:        e15c7c5ff963e1a0287f25bca401bc3dbe515f76
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Wed May 3 11:19:43 2017 +0100
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Wed May 3 11:19:43 2017 +0100

command: avoid compiler warning

man-generator.c:3243: warning: declaration of ???stat??? shadows a global declaration

---
 tools/command.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
tools/command.c +5 -5
index 347475b..0f69bbb 100644
@@ -3240,29 +3240,29 @@ static int include_description_file(char *name, char *des_file)
 	char *buf;
 	int fd, r = 0;
 	ssize_t sz;
-	struct stat stat;
+	struct stat statbuf;
 
 	if ((fd = open(des_file, O_RDONLY)) < 0) {
 		log_error("Failed to open description file %s.", des_file);
 		return 0;
 	}
 
-	if (fstat(fd, &stat) < 0) {
+	if (fstat(fd, &statbuf) < 0) {
 		log_error("Failed to stat description file %s.", des_file);
 		goto out_close;
 	}
 
-	if (stat.st_size > MAX_MAN_DESC) {
+	if (statbuf.st_size > MAX_MAN_DESC) {
 		log_error("Description file %s is too large.", des_file);
 		goto out_close;
 	}
 
-	if (!(buf = dm_malloc(stat.st_size + 1))) {
+	if (!(buf = dm_malloc(statbuf.st_size + 1))) {
 		log_error("Failed to allocate buffer for description file %s.", des_file);
 		goto out_close;
 	}
 
-	if ((sz = read(fd, buf, stat.st_size)) < 0) {
+	if ((sz = read(fd, buf, statbuf.st_size)) < 0) {
 		log_error("Failed to read description file %s.", des_file);
 		goto out_free;
 	}