[lvm-devel] master - command: avoid compiler warning

Alasdair Kergon agk at sourceware.org
Wed May 3 10:30:06 UTC 2017


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a0f742542f5762c4c80e52eab31819ea5abdb94b
Commit:        a0f742542f5762c4c80e52eab31819ea5abdb94b
Parent:        e15c7c5ff963e1a0287f25bca401bc3dbe515f76
Author:        Alasdair G Kergon <agk at redhat.com>
AuthorDate:    Wed May 3 11:19:43 2017 +0100
Committer:     Alasdair G Kergon <agk at redhat.com>
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(-)

diff --git a/tools/command.c b/tools/command.c
index 347475b..0f69bbb 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -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;
 	}




More information about the lvm-devel mailing list