From 58f0cb7e3110dcb8bcde02d136135721e2886d4d Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 10 Jun 1998 21:00:39 +0000 Subject: [PATCH] (sys_rename): Don't examine errno if rename didn't fail. --- src/w32.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/w32.c b/src/w32.c index 71ba574686f..da7d29b15a0 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1560,10 +1560,11 @@ sys_rename (const char * oldname, const char * newname) seems to make the second rename work properly. */ sprintf (p, ".%s.%u", o, i); i++; + result = rename (oldname, temp); } /* This loop must surely terminate! */ - while (rename (oldname, temp) < 0 && errno == EEXIST); - if (errno != EEXIST) + while (result < 0 && errno == EEXIST); + if (result < 0) return -1; } -- 2.39.2