aboutsummaryrefslogtreecommitdiff
path: root/binutils/rename.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-05-06 11:03:33 +0000
committerIan Lance Taylor <ian@airs.com>1999-05-06 11:03:33 +0000
commit82716b788e14918184e99a7ef97721fa87315959 (patch)
tree13cd975d6a26210ba91610f4205ad95d02b3e6ee /binutils/rename.c
parenta8a9050d4a058030a65f2501755e76225609798d (diff)
downloadgdb-82716b788e14918184e99a7ef97721fa87315959.zip
gdb-82716b788e14918184e99a7ef97721fa87315959.tar.gz
gdb-82716b788e14918184e99a7ef97721fa87315959.tar.bz2
* rename.c (smart_rename): Fix test of whether file exists.
Diffstat (limited to 'binutils/rename.c')
-rw-r--r--binutils/rename.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/binutils/rename.c b/binutils/rename.c
index fdc7263..f8314fb 100644
--- a/binutils/rename.c
+++ b/binutils/rename.c
@@ -139,17 +139,17 @@ smart_rename (from, to, preserve_dates)
const char *to;
int preserve_dates;
{
- int exists;
+ boolean exists;
struct stat s;
int ret = 0;
- exists = lstat (to, &s);
+ exists = lstat (to, &s) == 0;
#if defined (_WIN32) && !defined (__CYGWIN32__)
/* Win32, unlike unix, will not erase `to' in `rename(from, to)' but
fail instead. Also, chown is not present. */
- if (exists == 0)
+ if (exists)
remove (to);
ret = rename (from, to);
@@ -163,7 +163,7 @@ smart_rename (from, to, preserve_dates)
#else
/* Use rename only if TO is not a symbolic link and has
only one hard link. */
- if (exists < 0 || (!S_ISLNK (s.st_mode) && s.st_nlink == 1))
+ if (! exists || (!S_ISLNK (s.st_mode) && s.st_nlink == 1))
{
ret = rename (from, to);
if (ret == 0)