1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

command: avoid compiler warning

man-generator.c:3243: warning: declaration of ‘stat’ shadows a global
declaration
This commit is contained in:
Alasdair G Kergon 2017-05-03 11:19:43 +01:00
parent e15c7c5ff9
commit a0f742542f

View File

@ -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;
}