From 97c9ed026a7f7efe5fca02c188bcbdbcd7c594e9 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Wed, 25 Jan 2012 19:01:55 +0000 Subject: [PATCH] hw/xwin: Fix shadowed local variable i in HandleCustomWM_COMMAND() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix shadowed local variable i in HandleCustomWM_COMMAND() Also, fds are meant to be representable as an int winprefs.c: In function ‘HandleCustomWM_COMMAND’: winprefs.c:346:23: error: declaration of ‘i’ shadows a previous local winprefs.c:322:7: error: shadowed declaration is here Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winprefs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c index 5d2512e22..dbc5b5228 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -327,12 +327,12 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command) case CMD_EXEC: if (fork() == 0) { struct rlimit rl; - unsigned long i; + int fd; /* Close any open descriptors except for STD* */ getrlimit(RLIMIT_NOFILE, &rl); - for (i = STDERR_FILENO + 1; i < rl.rlim_cur; i++) - close(i); + for (fd = STDERR_FILENO + 1; fd < rl.rlim_cur; fd++) + close(fd); /* Disassociate any TTYs */ setsid();