From 8f0a649921a4d99c9168b48d30f1534221ac2a8f Mon Sep 17 00:00:00 2001 From: Dick Porter Date: Wed, 5 Jul 2006 15:53:27 +0000 Subject: [PATCH] 2006-07-05 Dick Porter * io.c (GetFileAttributes, GetFileAttributesEx): Cope with dangling symlinks. Fixes bug 78664. svn path=/branches/mono-1-1-13/mono/; revision=62270 --- mono/io-layer/ChangeLog | 5 +++++ mono/io-layer/io.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mono/io-layer/ChangeLog b/mono/io-layer/ChangeLog index 8f368d1c1fbbd..ca991c2b20387 100644 --- a/mono/io-layer/ChangeLog +++ b/mono/io-layer/ChangeLog @@ -1,3 +1,8 @@ +2006-07-05 Dick Porter + + * io.c (GetFileAttributes, GetFileAttributesEx): Cope with + dangling symlinks. Fixes bug 78664. + 2006-06-23 Dick Porter * handles.c (handle_cleanup): diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c index 25062980a05c2..a287267760f56 100644 --- a/mono/io-layer/io.c +++ b/mono/io-layer/io.c @@ -3074,7 +3074,11 @@ guint32 GetFileAttributes (const gunichar2 *name) } result = stat (utf8_name, &buf); - + if (result == -1 && errno == ENOENT) { + /* Might be a dangling symlink... */ + result = lstat (utf8_name, &buf); + } + if (result != 0) { _wapi_set_last_error_from_errno (); g_free (utf8_name); @@ -3134,6 +3138,11 @@ gboolean GetFileAttributesEx (const gunichar2 *name, WapiGetFileExInfoLevels lev } result = stat (utf8_name, &buf); + if (result == -1 && errno == ENOENT) { + /* Might be a dangling symlink... */ + result = lstat (utf8_name, &buf); + } + g_free (utf8_name); if (result != 0) {