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

gcc: declaration of tmpfile shadows a global

Rename tmpfile to tmppath to avoid declaration shadowing of:

/usr/include/stdio.h:174: warning: shadowed declaration is here
This commit is contained in:
Zdenek Kabelac 2021-03-21 23:32:12 +01:00
parent b6cff47bde
commit 09621725d0

View File

@ -604,7 +604,7 @@ out:
int device_ids_write(struct cmd_context *cmd)
{
char dirpath[PATH_MAX];
char tmpfile[PATH_MAX];
char tmppath[PATH_MAX];
char version_buf[VERSION_LINE_MAX] = {0};
FILE *fp;
int dir_fd;
@ -674,14 +674,14 @@ int device_ids_write(struct cmd_context *cmd)
goto out;
}
if (dm_snprintf(tmpfile, sizeof(tmpfile), "%s_new", cmd->devices_file_path) < 0) {
if (dm_snprintf(tmppath, sizeof(tmppath), "%s_new", cmd->devices_file_path) < 0) {
ret = 0;
goto out;
}
unlink(tmpfile); /* in case a previous file was left */
unlink(tmppath); /* in case a previous file was left */
if (!(fp = fopen(tmpfile, "w+"))) {
if (!(fp = fopen(tmppath, "w+"))) {
log_warn("Cannot open tmp devices_file to write.");
ret = 0;
goto out;
@ -689,7 +689,7 @@ int device_ids_write(struct cmd_context *cmd)
if ((dir_fd = open(dirpath, O_RDONLY)) < 0) {
if (fclose(fp))
log_sys_debug("fclose", tmpfile);
log_sys_debug("fclose", tmppath);
ret = 0;
goto out;
}
@ -744,7 +744,7 @@ int device_ids_write(struct cmd_context *cmd)
if (fclose(fp))
stack;
if (rename(tmpfile, cmd->devices_file_path) < 0) {
if (rename(tmppath, cmd->devices_file_path) < 0) {
log_error("Failed to replace devices file errno %d", errno);
ret = 0;
}