mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
build: avoid shadowed variable in fdstreamtest
On RHEL 6.4 (gcc 4.4.7), I got: fdstreamtest.c: In function 'testFDStreamReadCommon': fdstreamtest.c:44: error: declaration of 'tmpfile' shadows a global declaration [-Wshadow] * tests/fdstreamtest.c (testFDStreamReadCommon) (testFDStreamWriteCommon): Rename 'tmpfile' variable. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
3407e3b3a2
commit
84f3777a79
@ -41,7 +41,7 @@
|
|||||||
static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
|
static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
|
||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
char *tmpfile = NULL;
|
char *file = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *pattern = NULL;
|
char *pattern = NULL;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
@ -63,10 +63,10 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
|
|||||||
for (i = 0 ; i < PATTERN_LEN ; i++)
|
for (i = 0 ; i < PATTERN_LEN ; i++)
|
||||||
pattern[i] = i;
|
pattern[i] = i;
|
||||||
|
|
||||||
if (virAsprintf(&tmpfile, "%s/input.data", scratchdir) < 0)
|
if (virAsprintf(&file, "%s/input.data", scratchdir) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((fd = open(tmpfile, O_CREAT|O_WRONLY|O_EXCL, 0600)) < 0)
|
if ((fd = open(file, O_CREAT|O_WRONLY|O_EXCL, 0600)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0 ; i < 10 ; i++) {
|
for (i = 0 ; i < 10 ; i++) {
|
||||||
@ -83,7 +83,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
|
|||||||
/* Start reading 1/2 way through first pattern
|
/* Start reading 1/2 way through first pattern
|
||||||
* and end 1/2 way through last pattern
|
* and end 1/2 way through last pattern
|
||||||
*/
|
*/
|
||||||
if (virFDStreamOpenFile(st, tmpfile,
|
if (virFDStreamOpenFile(st, file,
|
||||||
PATTERN_LEN / 2, PATTERN_LEN * 9,
|
PATTERN_LEN / 2, PATTERN_LEN * 9,
|
||||||
O_RDONLY) < 0)
|
O_RDONLY) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -149,11 +149,11 @@ cleanup:
|
|||||||
if (st)
|
if (st)
|
||||||
virStreamFree(st);
|
virStreamFree(st);
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
if (tmpfile != NULL)
|
if (file != NULL)
|
||||||
unlink(tmpfile);
|
unlink(file);
|
||||||
if (conn)
|
if (conn)
|
||||||
virConnectClose(conn);
|
virConnectClose(conn);
|
||||||
VIR_FREE(tmpfile);
|
VIR_FREE(file);
|
||||||
VIR_FREE(pattern);
|
VIR_FREE(pattern);
|
||||||
VIR_FREE(buf);
|
VIR_FREE(buf);
|
||||||
return ret;
|
return ret;
|
||||||
@ -173,7 +173,7 @@ static int testFDStreamReadNonblock(const void *data)
|
|||||||
static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
|
static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
|
||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
char *tmpfile = NULL;
|
char *file = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *pattern = NULL;
|
char *pattern = NULL;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
@ -195,7 +195,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
|
|||||||
for (i = 0 ; i < PATTERN_LEN ; i++)
|
for (i = 0 ; i < PATTERN_LEN ; i++)
|
||||||
pattern[i] = i;
|
pattern[i] = i;
|
||||||
|
|
||||||
if (virAsprintf(&tmpfile, "%s/input.data", scratchdir) < 0)
|
if (virAsprintf(&file, "%s/input.data", scratchdir) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(st = virStreamNew(conn, flags)))
|
if (!(st = virStreamNew(conn, flags)))
|
||||||
@ -204,7 +204,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
|
|||||||
/* Start writing 1/2 way through first pattern
|
/* Start writing 1/2 way through first pattern
|
||||||
* and end 1/2 way through last pattern
|
* and end 1/2 way through last pattern
|
||||||
*/
|
*/
|
||||||
if (virFDStreamCreateFile(st, tmpfile,
|
if (virFDStreamCreateFile(st, file,
|
||||||
PATTERN_LEN / 2, PATTERN_LEN * 9,
|
PATTERN_LEN / 2, PATTERN_LEN * 9,
|
||||||
O_WRONLY, 0600) < 0)
|
O_WRONLY, 0600) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -244,7 +244,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fd = open(tmpfile, O_RDONLY)) < 0)
|
if ((fd = open(file, O_RDONLY)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0 ; i < 10 ; i++) {
|
for (i = 0 ; i < 10 ; i++) {
|
||||||
@ -292,11 +292,11 @@ cleanup:
|
|||||||
if (st)
|
if (st)
|
||||||
virStreamFree(st);
|
virStreamFree(st);
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
if (tmpfile != NULL)
|
if (file != NULL)
|
||||||
unlink(tmpfile);
|
unlink(file);
|
||||||
if (conn)
|
if (conn)
|
||||||
virConnectClose(conn);
|
virConnectClose(conn);
|
||||||
VIR_FREE(tmpfile);
|
VIR_FREE(file);
|
||||||
VIR_FREE(pattern);
|
VIR_FREE(pattern);
|
||||||
VIR_FREE(buf);
|
VIR_FREE(buf);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user