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