* path.cc (normalize_posix_path): Revert .. check removed by previous changes.
* cygheap.h: Temporarily declare path_prefix_p here.
This commit is contained in:
parent
9f13167f77
commit
ac5561f2ed
|
@ -1,3 +1,9 @@
|
||||||
|
Sun Jun 3 20:52:13 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* path.cc (normalize_posix_path): Revert .. check removed by previous
|
||||||
|
changes.
|
||||||
|
* cygheap.h: Temporarily declare path_prefix_p here.
|
||||||
|
|
||||||
Mon Jun 4 0:14:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
Mon Jun 4 0:14:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* net.cc (wsock_event): Add destructor.
|
* net.cc (wsock_event): Add destructor.
|
||||||
|
|
|
@ -46,6 +46,9 @@ struct cygheap_root_mount_info
|
||||||
unsigned native_pathlen;
|
unsigned native_pathlen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* CGF: FIXME This doesn't belong here */
|
||||||
|
|
||||||
|
int path_prefix_p (const char *path1, const char *path2, int len1) __attribute__ ((regparm (3)));
|
||||||
class cygheap_root
|
class cygheap_root
|
||||||
{
|
{
|
||||||
/* Root directory information.
|
/* Root directory information.
|
||||||
|
@ -55,7 +58,6 @@ class cygheap_root
|
||||||
public:
|
public:
|
||||||
bool posix_ok (const char *path)
|
bool posix_ok (const char *path)
|
||||||
{
|
{
|
||||||
extern int path_prefix_p (const char *, const char *, int);
|
|
||||||
if (!m)
|
if (!m)
|
||||||
return 1;
|
return 1;
|
||||||
return path_prefix_p (m->posix_path, path, m->posix_pathlen);
|
return path_prefix_p (m->posix_path, path, m->posix_pathlen);
|
||||||
|
|
|
@ -26,9 +26,9 @@ details. */
|
||||||
#include "perprocess.h"
|
#include "perprocess.h"
|
||||||
#include "fhandler.h"
|
#include "fhandler.h"
|
||||||
#include "dtable.h"
|
#include "dtable.h"
|
||||||
|
#include "path.h"
|
||||||
#include "cygheap.h"
|
#include "cygheap.h"
|
||||||
#include "child_info.h"
|
#include "child_info.h"
|
||||||
#include "path.h"
|
|
||||||
#include "perthread.h"
|
#include "perthread.h"
|
||||||
#include "shared_info.h"
|
#include "shared_info.h"
|
||||||
#include "cygwin_version.h"
|
#include "cygwin_version.h"
|
||||||
|
|
|
@ -89,7 +89,6 @@ static DWORD available_drives;
|
||||||
static int normalize_win32_path (const char *src, char *dst);
|
static int normalize_win32_path (const char *src, char *dst);
|
||||||
static void slashify (const char *src, char *dst, int trailing_slash_p);
|
static void slashify (const char *src, char *dst, int trailing_slash_p);
|
||||||
static void backslashify (const char *src, char *dst, int trailing_slash_p);
|
static void backslashify (const char *src, char *dst, int trailing_slash_p);
|
||||||
static int path_prefix_p (const char *path1, const char *path2, int len1);
|
|
||||||
|
|
||||||
struct symlink_info
|
struct symlink_info
|
||||||
{
|
{
|
||||||
|
@ -243,6 +242,12 @@ normalize_posix_path (const char *src, char *dst)
|
||||||
}
|
}
|
||||||
else if (src[2] && !isslash (src[2]))
|
else if (src[2] && !isslash (src[2]))
|
||||||
break;
|
break;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (dst > dst_start && !isslash (*--dst))
|
||||||
|
continue;
|
||||||
|
src++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*dst++ = '/';
|
*dst++ = '/';
|
||||||
|
@ -270,7 +275,7 @@ path_conv::add_ext_from_sym (symlink_info &sym)
|
||||||
{
|
{
|
||||||
known_suffix = path + sym.extn;
|
known_suffix = path + sym.extn;
|
||||||
if (sym.ext_tacked_on)
|
if (sym.ext_tacked_on)
|
||||||
strcpy (known_suffix, sym.ext_here);
|
strcpy (known_suffix, sym.ext_here);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,17 +456,17 @@ path_conv::check (const char *src, unsigned opt,
|
||||||
if (sym.case_clash)
|
if (sym.case_clash)
|
||||||
{
|
{
|
||||||
if (pcheck_case == PCHECK_STRICT)
|
if (pcheck_case == PCHECK_STRICT)
|
||||||
{
|
{
|
||||||
case_clash = TRUE;
|
case_clash = TRUE;
|
||||||
error = ENOENT;
|
error = ENOENT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/* If pcheck_case==PCHECK_ADJUST the case_clash is remembered
|
/* If pcheck_case==PCHECK_ADJUST the case_clash is remembered
|
||||||
if the last component is concerned. This allows functions
|
if the last component is concerned. This allows functions
|
||||||
which shall create files to avoid overriding already existing
|
which shall create files to avoid overriding already existing
|
||||||
files with another case. */
|
files with another case. */
|
||||||
if (!component)
|
if (!component)
|
||||||
case_clash = TRUE;
|
case_clash = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(opt & PC_SYM_IGNORE))
|
if (!(opt & PC_SYM_IGNORE))
|
||||||
|
@ -499,15 +504,15 @@ path_conv::check (const char *src, unsigned opt,
|
||||||
set_symlink (); // last component of path is a symlink.
|
set_symlink (); // last component of path is a symlink.
|
||||||
fileattr = sym.fileattr;
|
fileattr = sym.fileattr;
|
||||||
if (opt & PC_SYM_CONTENTS)
|
if (opt & PC_SYM_CONTENTS)
|
||||||
{
|
{
|
||||||
strcpy (path, sym.contents);
|
strcpy (path, sym.contents);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
add_ext_from_sym (sym);
|
add_ext_from_sym (sym);
|
||||||
if (pcheck_case == PCHECK_RELAXED)
|
if (pcheck_case == PCHECK_RELAXED)
|
||||||
goto out;
|
goto out;
|
||||||
/* Avoid further symlink evaluation. Only case checks are
|
/* Avoid further symlink evaluation. Only case checks are
|
||||||
done now. */
|
done now. */
|
||||||
opt |= PC_SYM_IGNORE;
|
opt |= PC_SYM_IGNORE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -617,7 +622,7 @@ out:
|
||||||
|
|
||||||
if (!rootdir (tmp_buf) ||
|
if (!rootdir (tmp_buf) ||
|
||||||
!GetVolumeInformation (tmp_buf, NULL, 0, &vol_serial, NULL,
|
!GetVolumeInformation (tmp_buf, NULL, 0, &vol_serial, NULL,
|
||||||
&vol_flags, fs_name, 16))
|
&vol_flags, fs_name, 16))
|
||||||
{
|
{
|
||||||
debug_printf ("GetVolumeInformation(%s) = ERR, this->path(%s), set_has_acls(FALSE)",
|
debug_printf ("GetVolumeInformation(%s) = ERR, this->path(%s), set_has_acls(FALSE)",
|
||||||
tmp_buf, this->path, GetLastError ());
|
tmp_buf, this->path, GetLastError ());
|
||||||
|
@ -633,11 +638,11 @@ out:
|
||||||
if (drive_type == DRIVE_REMOTE || (drive_type == DRIVE_UNKNOWN && (tmp_buf[0] == '\\' && tmp_buf[1] == '\\')))
|
if (drive_type == DRIVE_REMOTE || (drive_type == DRIVE_UNKNOWN && (tmp_buf[0] == '\\' && tmp_buf[1] == '\\')))
|
||||||
is_remote_drive = 1;
|
is_remote_drive = 1;
|
||||||
if (!allow_smbntsec && is_remote_drive)
|
if (!allow_smbntsec && is_remote_drive)
|
||||||
set_has_acls (FALSE);
|
set_has_acls (FALSE);
|
||||||
else
|
else
|
||||||
set_has_acls (vol_flags & FS_PERSISTENT_ACLS);
|
set_has_acls (vol_flags & FS_PERSISTENT_ACLS);
|
||||||
/* Known file systems with buggy open calls. Further explanation
|
/* Known file systems with buggy open calls. Further explanation
|
||||||
in fhandler.cc (fhandler_disk_file::open). */
|
in fhandler.cc (fhandler_disk_file::open). */
|
||||||
set_has_buggy_open (strcmp (fs_name, "SUNWNFS") == 0);
|
set_has_buggy_open (strcmp (fs_name, "SUNWNFS") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2182,10 +2187,10 @@ cygdrive_getmntent ()
|
||||||
__small_sprintf (native_path, "%c:\\", drive);
|
__small_sprintf (native_path, "%c:\\", drive);
|
||||||
if (GetDriveType (native_path) == DRIVE_REMOVABLE ||
|
if (GetDriveType (native_path) == DRIVE_REMOVABLE ||
|
||||||
GetFileAttributes (native_path) == (DWORD) -1)
|
GetFileAttributes (native_path) == (DWORD) -1)
|
||||||
{
|
{
|
||||||
available_drives &= ~mask;
|
available_drives &= ~mask;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
native_path[2] = '\0';
|
native_path[2] = '\0';
|
||||||
__small_sprintf (posix_path, "%s%c", mount_table->cygdrive, drive);
|
__small_sprintf (posix_path, "%s%c", mount_table->cygdrive, drive);
|
||||||
ret = fillout_mntent (native_path, posix_path, mount_table->cygdrive_flags);
|
ret = fillout_mntent (native_path, posix_path, mount_table->cygdrive_flags);
|
||||||
|
@ -2405,7 +2410,7 @@ symlink (const char *topath, const char *frompath)
|
||||||
unsigned short len = strlen (topath);
|
unsigned short len = strlen (topath);
|
||||||
unsigned short win_len = strlen (w32topath);
|
unsigned short win_len = strlen (w32topath);
|
||||||
success = WriteFile (h, shortcut_header, SHORTCUT_HDR_SIZE,
|
success = WriteFile (h, shortcut_header, SHORTCUT_HDR_SIZE,
|
||||||
&written, NULL)
|
&written, NULL)
|
||||||
&& written == SHORTCUT_HDR_SIZE
|
&& written == SHORTCUT_HDR_SIZE
|
||||||
&& WriteFile (h, &len, sizeof len, &written, NULL)
|
&& WriteFile (h, &len, sizeof len, &written, NULL)
|
||||||
&& written == sizeof len
|
&& written == sizeof len
|
||||||
|
@ -2426,7 +2431,7 @@ symlink (const char *topath, const char *frompath)
|
||||||
|
|
||||||
/* Note that the terminating nul is written. */
|
/* Note that the terminating nul is written. */
|
||||||
success = WriteFile (h, buf, len, &written, NULL)
|
success = WriteFile (h, buf, len, &written, NULL)
|
||||||
|| written != len;
|
|| written != len;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (success)
|
if (success)
|
||||||
|
@ -2436,8 +2441,8 @@ symlink (const char *topath, const char *frompath)
|
||||||
win32_path.get_win32 (),
|
win32_path.get_win32 (),
|
||||||
S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO);
|
S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
SetFileAttributesA (win32_path.get_win32 (),
|
SetFileAttributesA (win32_path.get_win32 (),
|
||||||
allow_winsymlinks ? FILE_ATTRIBUTE_READONLY
|
allow_winsymlinks ? FILE_ATTRIBUTE_READONLY
|
||||||
: FILE_ATTRIBUTE_SYSTEM);
|
: FILE_ATTRIBUTE_SYSTEM);
|
||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2678,15 +2683,15 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
|
||||||
ext_tacked_on = !!*ext_here;
|
ext_tacked_on = !!*ext_here;
|
||||||
|
|
||||||
if (pcheck_case != PCHECK_RELAXED && !case_check (path)
|
if (pcheck_case != PCHECK_RELAXED && !case_check (path)
|
||||||
|| (opt & PC_SYM_IGNORE))
|
|| (opt & PC_SYM_IGNORE))
|
||||||
goto file_not_symlink;
|
goto file_not_symlink;
|
||||||
|
|
||||||
int sym_check;
|
int sym_check;
|
||||||
|
|
||||||
sym_check = 0;
|
sym_check = 0;
|
||||||
|
|
||||||
if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
|
if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
goto file_not_symlink;
|
goto file_not_symlink;
|
||||||
|
|
||||||
/* Windows shortcuts are treated as symlinks. */
|
/* Windows shortcuts are treated as symlinks. */
|
||||||
if (suffix.lnk_match ())
|
if (suffix.lnk_match ())
|
||||||
|
@ -2974,7 +2979,7 @@ chdir (const char *dir)
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
else if (!path.has_symlinks () && strpbrk (dir, ":\\") == NULL
|
else if (!path.has_symlinks () && strpbrk (dir, ":\\") == NULL
|
||||||
&& pcheck_case == PCHECK_RELAXED)
|
&& pcheck_case == PCHECK_RELAXED)
|
||||||
cygheap->cwd.set (path, dir);
|
cygheap->cwd.set (path, dir);
|
||||||
else
|
else
|
||||||
cygheap->cwd.set (path, NULL);
|
cygheap->cwd.set (path, NULL);
|
||||||
|
|
|
@ -167,5 +167,5 @@ has_exec_chars (const char *buf, int len)
|
||||||
(buf[0] == 'M' && buf[1] == 'Z'));
|
(buf[0] == 'M' && buf[1] == 'Z'));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int pathmatch (const char *path1, const char *path2);
|
int pathmatch (const char *path1, const char *path2) __attribute__ ((regparm (2)));
|
||||||
extern int pathnmatch (const char *path1, const char *path2, int len);
|
int pathnmatch (const char *path1, const char *path2, int len) __attribute__ ((regparm (2)));
|
||||||
|
|
Loading…
Reference in New Issue