for file attributes throughout.
* fhandler.cc: Ditto.
* fhandler_disk_file.cc: Ditto.
* path.cc: Ditto.
* path.h: Ditto.
* syscalls.cc: Ditto.
* times.cc (utimes): Use path_conv::isdir() instead of explicit
GetFileAttributes() call.
+2002-01-14 Corinna Vinschen <corinna@vinschen.de>
+
+ * dir.cc: Use INVALID_FILE_ATTRIBUTES instead of "(DWORD) -1"
+ for file attributes throughout.
+ * fhandler.cc: Ditto.
+ * fhandler_disk_file.cc: Ditto.
+ * path.cc: Ditto.
+ * path.h: Ditto.
+ * syscalls.cc: Ditto.
+ * times.cc (utimes): Use path_conv::isdir() instead of explicit
+ GetFileAttributes() call.
+
2002-01-13 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (multiple_cygwin_problem): Clarify logic and make
/* RemoveDirectory on a samba drive doesn't return an error if the
directory can't be removed because it's not empty. Checking for
existence afterwards keeps us informed about success. */
- if (GetFileAttributes (real_dir) != (DWORD) -1)
+ if (GetFileAttributes (real_dir) != INVALID_FILE_ATTRIBUTES)
set_errno (ENOTEMPTY);
else
res = 0;
/* fhandler.cc. See console.cc for fhandler_console functions.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
if (get_query_open () &&
isremote () &&
creation_distribution == OPEN_EXISTING &&
- GetFileAttributes (get_win32_name ()) == (DWORD) -1)
+ GetFileAttributes (get_win32_name ()) == INVALID_FILE_ATTRIBUTES)
{
set_errno (ENOENT);
goto done;
/* fhandler_disk_file.cc
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
which returns a valid handle when trying to open a file in a nonexistent
directory. */
if (real_path->has_buggy_open ()
- && GetFileAttributes (win32_path_name) == (DWORD) -1)
+ && GetFileAttributes (win32_path_name) == INVALID_FILE_ATTRIBUTES)
{
debug_printf ("Buggy open detected.");
close ();
set_errno (ENMFILE);
return NULL;
}
- if (GetFileAttributes (pdrive) == (DWORD) -1)
+ if (GetFileAttributes (pdrive) == INVALID_FILE_ATTRIBUTES)
{
pdrive += DRVSZ;
return readdir (dir);
/* path.cc: path support.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
int loop = 0;
path_flags = 0;
known_suffix = NULL;
- fileattr = (DWORD) -1;
+ fileattr = INVALID_FILE_ATTRIBUTES;
case_clash = false;
devn = unit = 0;
root_dir[0] = '\0';
/* If symlink.check found an existing non-symlink file, then
it sets the appropriate flag. It also sets any suffix found
into `ext_here'. */
- if (!sym.is_symlink && sym.fileattr != (DWORD) -1)
+ if (!sym.is_symlink && sym.fileattr != INVALID_FILE_ATTRIBUTES)
{
error = sym.error;
if (component == 0)
__small_sprintf (native_path, "%c:\\", drive);
if (GetDriveType (native_path) == DRIVE_REMOVABLE ||
- GetFileAttributes (native_path) == (DWORD) -1)
+ GetFileAttributes (native_path) == INVALID_FILE_ATTRIBUTES)
{
available_drives &= ~mask;
continue;
}
backslashify (topath, w32topath, 0);
}
- if (!cp || GetFileAttributes (w32topath) == (DWORD)-1)
+ if (!cp || GetFileAttributes (w32topath) == INVALID_FILE_ATTRIBUTES)
{
win32_topath.check (topath, PC_SYM_NOFOLLOW);
if (!cp || win32_topath.error != ENOENT)
{
error = 0;
fileattr = GetFileAttributes (suffix.path);
- if (fileattr == (DWORD) -1)
+ if (fileattr == INVALID_FILE_ATTRIBUTES)
{
/* The GetFileAttributes call can fail for reasons that don't
matter, so we just return 0. For example, getting the
if (!suffix.lnk_match () || !ext_tacked_on)
goto file_not_symlink;
- fileattr = (DWORD) -1;
+ fileattr = INVALID_FILE_ATTRIBUTES;
continue; /* in case we're going to tack *another* .lnk on this filename. */
case 2:
res = check_sysfile (suffix.path, fileattr, h, contents, &error, &pflags);
if (!pathbuf.issymlink ())
{
- if (pathbuf.fileattr != (DWORD) -1)
+ if (pathbuf.fileattr != INVALID_FILE_ATTRIBUTES)
set_errno (EINVAL);
return -1;
}
/* path.h: path data structures
- Copyright 1996, 1997, 1998, 2000 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
int issymlink () const {return path_flags & PATH_SYMLINK;}
int issocket () const {return path_flags & PATH_SOCKET;}
int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;}
- bool exists () const {return fileattr != (DWORD) -1;}
+ bool exists () const {return fileattr != INVALID_FILE_ATTRIBUTES;}
bool has_attribute (DWORD x) const {return exists () && (fileattr & x);}
int isdir () const {return has_attribute (FILE_ATTRIBUTE_DIRECTORY);}
executable_states exec_state ()
check (src, opt | PC_NULLEMPTY, suffixes);
}
- path_conv (): path_flags (0), known_suffix (NULL), error (0), devn (0), unit (0), fileattr (0xffffffff) {path[0] = '\0';}
+ path_conv (): path_flags (0), known_suffix (NULL), error (0), devn (0), unit (0), fileattr (INVALID_FILE_ATTRIBUTES) {path[0] = '\0';}
inline char *get_win32 () { return path; }
operator char *() {return path; }
syscall_printf ("CreateFile/CloseHandle succeeded");
/* Everything is fine if the file has disappeared or if we know that the
FILE_FLAG_DELETE_ON_CLOSE will eventually work. */
- if (GetFileAttributes (win32_name) == (DWORD) -1 || delete_on_close_ok)
+ if (GetFileAttributes (win32_name) == INVALID_FILE_ATTRIBUTES
+ || delete_on_close_ok)
goto ok; /* The file is either gone already or will eventually be
deleted by the OS. */
}
/* times.cc
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
if (h == INVALID_HANDLE_VALUE)
{
- if ((res = GetFileAttributes (win32.get_win32 ())) != -1 &&
- (res & FILE_ATTRIBUTE_DIRECTORY))
+ if (win32.isdir ())
{
/* What we can do with directories more? */
res = 0;