* path.cc (path_conv::check): Always set fileattr when component == 0.
(readlink): Use path_conv method rather than field. * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto, throughout. * path.h (path_conv): Make fileattr private. * exceptions.cc (try_to_debug): Default to idle priority when looping.
This commit is contained in:
parent
63a93e9dd6
commit
99138976d9
|
@ -1,3 +1,12 @@
|
|||
2002-07-24 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* path.cc (path_conv::check): Always set fileattr when component == 0.
|
||||
(readlink): Use path_conv method rather than field.
|
||||
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto,
|
||||
throughout.
|
||||
* path.h (path_conv): Make fileattr private.
|
||||
* exceptions.cc (try_to_debug): Default to idle priority when looping.
|
||||
|
||||
2002-07-23 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* fhandler_serial.cc: Use must_init_serial_line capability throughout.
|
||||
|
|
|
@ -391,9 +391,9 @@ try_to_debug (bool waitloop)
|
|||
system_printf ("Failed to start debugger: %E");
|
||||
else
|
||||
{
|
||||
SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE);
|
||||
if (!waitloop)
|
||||
return 1;
|
||||
SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE);
|
||||
while (!being_debugged ())
|
||||
/* spin */;
|
||||
Sleep (4000);
|
||||
|
|
|
@ -260,7 +260,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc,
|
|||
buf->st_mode = 0;
|
||||
/* Using a side effect: get_file_attibutes checks for
|
||||
directory. This is used, to set S_ISVTX, if needed. */
|
||||
if (pc->fileattr & FILE_ATTRIBUTE_DIRECTORY)
|
||||
if (pc->isdir ())
|
||||
buf->st_mode = S_IFDIR;
|
||||
else if (pc->issymlink ())
|
||||
buf->st_mode = S_IFLNK;
|
||||
|
@ -273,7 +273,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc,
|
|||
&uid, &gid) == 0)
|
||||
{
|
||||
/* If read-only attribute is set, modify ntsec return value */
|
||||
if ((pc->fileattr & FILE_ATTRIBUTE_READONLY) && !get_symlink_p ())
|
||||
if (pc->has_attribute (FILE_ATTRIBUTE_READONLY) && !get_symlink_p ())
|
||||
buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
|
||||
|
||||
if (!(buf->st_mode & S_IFMT))
|
||||
|
@ -283,7 +283,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc,
|
|||
{
|
||||
buf->st_mode |= STD_RBITS;
|
||||
|
||||
if (!(pc->fileattr & FILE_ATTRIBUTE_READONLY))
|
||||
if (!pc->has_attribute (FILE_ATTRIBUTE_READONLY))
|
||||
buf->st_mode |= STD_WBITS;
|
||||
/* | S_IWGRP | S_IWOTH; we don't give write to group etc */
|
||||
|
||||
|
|
|
@ -447,7 +447,6 @@ path_conv::check (const char *src, unsigned opt,
|
|||
error = 0;
|
||||
else if ((error = check_null_empty_str (src)))
|
||||
return;
|
||||
|
||||
/* This loop handles symlink expansion. */
|
||||
for (;;)
|
||||
{
|
||||
|
@ -603,7 +602,10 @@ path_conv::check (const char *src, unsigned opt,
|
|||
if (!(opt & PC_SYM_IGNORE))
|
||||
{
|
||||
if (!component)
|
||||
path_flags = sym.pflags;
|
||||
{
|
||||
fileattr = sym.fileattr;
|
||||
path_flags = sym.pflags;
|
||||
}
|
||||
|
||||
/* If symlink.check found an existing non-symlink file, then
|
||||
it sets the appropriate flag. It also sets any suffix found
|
||||
|
@ -612,10 +614,7 @@ path_conv::check (const char *src, unsigned opt,
|
|||
{
|
||||
error = sym.error;
|
||||
if (component == 0)
|
||||
{
|
||||
fileattr = sym.fileattr;
|
||||
add_ext_from_sym (sym);
|
||||
}
|
||||
add_ext_from_sym (sym);
|
||||
if (pcheck_case == PCHECK_RELAXED)
|
||||
goto out; // file found
|
||||
/* Avoid further symlink evaluation. Only case checks are
|
||||
|
@ -633,7 +632,6 @@ path_conv::check (const char *src, unsigned opt,
|
|||
if (component == 0 && !need_directory && !(opt & PC_SYM_FOLLOW))
|
||||
{
|
||||
set_symlink (); // last component of path is a symlink.
|
||||
fileattr = sym.fileattr;
|
||||
if (opt & PC_SYM_CONTENTS)
|
||||
{
|
||||
strcpy (path, sym.contents);
|
||||
|
@ -3072,7 +3070,7 @@ readlink (const char *path, char *buf, int buflen)
|
|||
|
||||
if (!pathbuf.issymlink ())
|
||||
{
|
||||
if (pathbuf.fileattr != INVALID_FILE_ATTRIBUTES)
|
||||
if (pathbuf.exists ())
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ struct fs_info
|
|||
class path_conv
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
DWORD fileattr;
|
||||
fs_info fs;
|
||||
void add_ext_from_sym (symlink_info&);
|
||||
public:
|
||||
|
@ -79,7 +80,6 @@ class path_conv
|
|||
int error;
|
||||
DWORD devn;
|
||||
int unit;
|
||||
DWORD fileattr;
|
||||
BOOL case_clash;
|
||||
char *normalized_path;
|
||||
|
||||
|
@ -138,8 +138,8 @@ class path_conv
|
|||
check (src, opt | PC_NULLEMPTY, suffixes);
|
||||
}
|
||||
|
||||
path_conv (): path_flags (0), known_suffix (NULL), error (0), devn (0),
|
||||
unit (0), fileattr (INVALID_FILE_ATTRIBUTES),
|
||||
path_conv (): fileattr (INVALID_FILE_ATTRIBUTES), path_flags (0),
|
||||
known_suffix (NULL), error (0), devn (0), unit (0),
|
||||
normalized_path (NULL) {path[0] = '\0';}
|
||||
|
||||
inline char *get_win32 () { return path; }
|
||||
|
|
Loading…
Reference in New Issue