dbus/dbus-sysdeps-util-win.c: use GetFileAttributes instead of CreateFile in _dbus_fi...
authorTor Lillqvist <tml@iki.fi>
Wed, 22 Apr 2009 14:35:43 +0000 (16:35 +0200)
committerRalf Habacker <ralf.habacker@freenet.de>
Mon, 30 Nov 2009 12:43:16 +0000 (13:43 +0100)
dbus/dbus-sysdeps-util-win.c

index 620862f..51fcb39 100644 (file)
@@ -406,24 +406,12 @@ _dbus_set_signal_handler (int               sig,
 dbus_bool_t 
 _dbus_file_exists (const char *file)
 {
-  HANDLE h = CreateFile(
-          file, /* LPCTSTR lpFileName*/
-          0, /* DWORD dwDesiredAccess */
-          0, /* DWORD dwShareMode*/
-          NULL, /* LPSECURITY_ATTRIBUTES lpSecurityAttributes */
-          OPEN_EXISTING, /* DWORD dwCreationDisposition */
-          FILE_ATTRIBUTE_NORMAL, /* DWORD dwFlagsAndAttributes */
-          NULL /* HANDLE hTemplateFile */
-        );
-
-    /* file not found, use local copy of session.conf  */
-    if (h != INVALID_HANDLE_VALUE && GetLastError() != ERROR_PATH_NOT_FOUND)
-      {
-        CloseHandle(h);
-        return TRUE;
-      }
-    else
-        return FALSE;  
+  DWORD attributes = GetFileAttributes (file);
+
+  if (attributes != INVALID_FILE_ATTRIBUTES && GetLastError() != ERROR_PATH_NOT_FOUND)
+    return TRUE;
+  else
+    return FALSE;  
 }
 
 /**