mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-07 15:00:24 +08:00
Remove PC_FULL from path_conv usage throughout.
* path.h (enum pathconv_arg): Change PC_FULL to PC_NOUILL. * path.cc (path_conv::check): Test for PC_NOFULL rather than !PC_FULL. (cygwin_conv_to_win32_path): Use PC_NOFULL to force non-absolute path.
This commit is contained in:
parent
eb6cd95fec
commit
063f1df2aa
@ -1,3 +1,10 @@
|
|||||||
|
2005-05-13 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
Remove PC_FULL from path_conv usage throughout.
|
||||||
|
* path.h (enum pathconv_arg): Change PC_FULL to PC_NOUILL.
|
||||||
|
* path.cc (path_conv::check): Test for PC_NOFULL rather than !PC_FULL.
|
||||||
|
(cygwin_conv_to_win32_path): Use PC_NOFULL to force non-absolute path.
|
||||||
|
|
||||||
2005-05-13 Christopher Faylor <cgf@timesys.com>
|
2005-05-13 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* fhandler_netdrive.cc (fhandler_netdrive::exists): Assert that "//"
|
* fhandler_netdrive.cc (fhandler_netdrive::exists): Assert that "//"
|
||||||
|
@ -45,7 +45,7 @@ opendir (const char *name)
|
|||||||
fhandler_base *fh;
|
fhandler_base *fh;
|
||||||
DIR *res;
|
DIR *res;
|
||||||
|
|
||||||
fh = build_fh_name (name, NULL, PC_SYM_FOLLOW | PC_FULL);
|
fh = build_fh_name (name, NULL, PC_SYM_FOLLOW);
|
||||||
if (!fh)
|
if (!fh)
|
||||||
res = NULL;
|
res = NULL;
|
||||||
else if (fh->exists ())
|
else if (fh->exists ())
|
||||||
@ -264,7 +264,7 @@ rmdir (const char *dir)
|
|||||||
{
|
{
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
path_conv real_dir (dir, PC_SYM_NOFOLLOW | PC_FULL | PC_WRITABLE);
|
path_conv real_dir (dir, PC_SYM_NOFOLLOW | PC_WRITABLE);
|
||||||
|
|
||||||
if (real_dir.error)
|
if (real_dir.error)
|
||||||
set_errno (real_dir.error);
|
set_errno (real_dir.error);
|
||||||
|
@ -338,7 +338,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
|
|||||||
fhandler_base *
|
fhandler_base *
|
||||||
build_fh_name (const char *name, HANDLE h, unsigned opt, suffix_info *si)
|
build_fh_name (const char *name, HANDLE h, unsigned opt, suffix_info *si)
|
||||||
{
|
{
|
||||||
path_conv pc (name, opt | PC_NULLEMPTY | PC_FULL | PC_POSIX, si);
|
path_conv pc (name, opt | PC_NULLEMPTY | PC_POSIX, si);
|
||||||
if (pc.error)
|
if (pc.error)
|
||||||
{
|
{
|
||||||
fhandler_base *fh = cnew (fhandler_nodevice) ();
|
fhandler_base *fh = cnew (fhandler_nodevice) ();
|
||||||
|
@ -294,7 +294,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
|||||||
case CW_GET_BINMODE:
|
case CW_GET_BINMODE:
|
||||||
{
|
{
|
||||||
const char *path = va_arg (arg, const char *);
|
const char *path = va_arg (arg, const char *);
|
||||||
path_conv p (path, PC_SYM_FOLLOW | PC_FULL | PC_NULLEMPTY);
|
path_conv p (path, PC_SYM_FOLLOW | PC_NULLEMPTY);
|
||||||
if (p.error)
|
if (p.error)
|
||||||
{
|
{
|
||||||
set_errno (p.error);
|
set_errno (p.error);
|
||||||
|
@ -681,7 +681,7 @@ fhandler_disk_file::ftruncate (_off64_t length)
|
|||||||
int
|
int
|
||||||
fhandler_disk_file::link (const char *newpath)
|
fhandler_disk_file::link (const char *newpath)
|
||||||
{
|
{
|
||||||
path_conv newpc (newpath, PC_SYM_NOFOLLOW | PC_FULL | PC_POSIX);
|
path_conv newpc (newpath, PC_SYM_NOFOLLOW | PC_POSIX);
|
||||||
extern bool allow_winsymlinks;
|
extern bool allow_winsymlinks;
|
||||||
|
|
||||||
if (newpc.error)
|
if (newpc.error)
|
||||||
@ -711,7 +711,7 @@ fhandler_disk_file::link (const char *newpath)
|
|||||||
strcpy (new_lnk_buf, newpath);
|
strcpy (new_lnk_buf, newpath);
|
||||||
strcat (new_lnk_buf, ".lnk");
|
strcat (new_lnk_buf, ".lnk");
|
||||||
newpath = new_lnk_buf;
|
newpath = new_lnk_buf;
|
||||||
newpc.check (newpath, PC_SYM_NOFOLLOW | PC_FULL);
|
newpc.check (newpath, PC_SYM_NOFOLLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
query_open (query_write_attributes);
|
query_open (query_write_attributes);
|
||||||
|
@ -956,7 +956,7 @@ out:
|
|||||||
devn = FH_SOCKET;
|
devn = FH_SOCKET;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(opt & PC_FULL))
|
if (opt & PC_NOFULL)
|
||||||
{
|
{
|
||||||
if (is_relpath)
|
if (is_relpath)
|
||||||
mkrelpath (this->path);
|
mkrelpath (this->path);
|
||||||
@ -2679,7 +2679,7 @@ symlink_worker (const char *topath, const char *frompath, bool use_winsym,
|
|||||||
strcpy (w32topath, reltopath);
|
strcpy (w32topath, reltopath);
|
||||||
if (use_winsym)
|
if (use_winsym)
|
||||||
{
|
{
|
||||||
win32_topath.check (topath, PC_FULL | PC_SYM_NOFOLLOW);
|
win32_topath.check (topath, PC_SYM_NOFOLLOW);
|
||||||
strcpy (w32topath, win32_topath);
|
strcpy (w32topath, win32_topath);
|
||||||
}
|
}
|
||||||
if (cp)
|
if (cp)
|
||||||
@ -2690,7 +2690,7 @@ symlink_worker (const char *topath, const char *frompath, bool use_winsym,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
win32_topath.check (topath, PC_FULL | PC_SYM_NOFOLLOW);
|
win32_topath.check (topath, PC_SYM_NOFOLLOW);
|
||||||
strcpy (w32topath, win32_topath);
|
strcpy (w32topath, win32_topath);
|
||||||
}
|
}
|
||||||
create_how = CREATE_NEW;
|
create_how = CREATE_NEW;
|
||||||
@ -3433,7 +3433,7 @@ chdir (const char *in_dir)
|
|||||||
|
|
||||||
/* Convert path. First argument ensures that we don't check for NULL/empty/invalid
|
/* Convert path. First argument ensures that we don't check for NULL/empty/invalid
|
||||||
again. */
|
again. */
|
||||||
path_conv path (PC_NONULLEMPTY, in_dir, PC_FULL | PC_SYM_FOLLOW | PC_POSIX);
|
path_conv path (PC_NONULLEMPTY, in_dir, PC_SYM_FOLLOW | PC_POSIX);
|
||||||
if (path.error)
|
if (path.error)
|
||||||
{
|
{
|
||||||
set_errno (path.error);
|
set_errno (path.error);
|
||||||
@ -3518,7 +3518,7 @@ fchdir (int fd)
|
|||||||
extern "C" int
|
extern "C" int
|
||||||
cygwin_conv_to_win32_path (const char *path, char *win32_path)
|
cygwin_conv_to_win32_path (const char *path, char *win32_path)
|
||||||
{
|
{
|
||||||
path_conv p (path, PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK);
|
path_conv p (path, PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOFULL);
|
||||||
if (p.error)
|
if (p.error)
|
||||||
{
|
{
|
||||||
win32_path[0] = '\0';
|
win32_path[0] = '\0';
|
||||||
@ -3533,7 +3533,7 @@ cygwin_conv_to_win32_path (const char *path, char *win32_path)
|
|||||||
extern "C" int
|
extern "C" int
|
||||||
cygwin_conv_to_full_win32_path (const char *path, char *win32_path)
|
cygwin_conv_to_full_win32_path (const char *path, char *win32_path)
|
||||||
{
|
{
|
||||||
path_conv p (path, PC_SYM_FOLLOW | PC_FULL | PC_NO_ACCESS_CHECK);
|
path_conv p (path, PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK);
|
||||||
if (p.error)
|
if (p.error)
|
||||||
{
|
{
|
||||||
win32_path[0] = '\0';
|
win32_path[0] = '\0';
|
||||||
@ -3571,7 +3571,7 @@ realpath (const char *path, char *resolved)
|
|||||||
extern suffix_info stat_suffixes[];
|
extern suffix_info stat_suffixes[];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
path_conv real_path (path, PC_SYM_FOLLOW | PC_FULL, stat_suffixes);
|
path_conv real_path (path, PC_SYM_FOLLOW, stat_suffixes);
|
||||||
|
|
||||||
if (real_path.error)
|
if (real_path.error)
|
||||||
err = real_path.error;
|
err = real_path.error;
|
||||||
@ -3624,7 +3624,7 @@ conv_path_list_buf_size (const char *path_list, bool to_posix)
|
|||||||
int i, num_elms, max_mount_path_len, size;
|
int i, num_elms, max_mount_path_len, size;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
path_conv pc(".", PC_FULL | PC_POSIX);
|
path_conv pc(".", PC_POSIX);
|
||||||
/* The theory is that an upper bound is
|
/* The theory is that an upper bound is
|
||||||
current_size + (num_elms * max_mount_path_len) */
|
current_size + (num_elms * max_mount_path_len) */
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ enum pathconv_arg
|
|||||||
PC_SYM_NOFOLLOW = 0x0002,
|
PC_SYM_NOFOLLOW = 0x0002,
|
||||||
PC_SYM_IGNORE = 0x0004,
|
PC_SYM_IGNORE = 0x0004,
|
||||||
PC_SYM_CONTENTS = 0x0008,
|
PC_SYM_CONTENTS = 0x0008,
|
||||||
PC_FULL = 0x0010,
|
PC_NOFULL = 0x0010,
|
||||||
PC_NULLEMPTY = 0x0020,
|
PC_NULLEMPTY = 0x0020,
|
||||||
PC_CHECK_EA = 0x0040,
|
PC_CHECK_EA = 0x0040,
|
||||||
PC_POSIX = 0x0080,
|
PC_POSIX = 0x0080,
|
||||||
|
@ -412,8 +412,7 @@ acl_worker (const char *path, int cmd, int nentries, __aclent32_t *aclbufp,
|
|||||||
{
|
{
|
||||||
extern suffix_info stat_suffixes[];
|
extern suffix_info stat_suffixes[];
|
||||||
int res = -1;
|
int res = -1;
|
||||||
fhandler_base *fh = build_fh_name (path, NULL, fmode | PC_FULL,
|
fhandler_base *fh = build_fh_name (path, NULL, fmode, stat_suffixes);
|
||||||
stat_suffixes);
|
|
||||||
if (fh->error ())
|
if (fh->error ())
|
||||||
{
|
{
|
||||||
debug_printf ("got %d error from build_fh_name", fh->error ());
|
debug_printf ("got %d error from build_fh_name", fh->error ());
|
||||||
|
@ -59,7 +59,7 @@ perhaps_suffix (const char *prog, path_conv& buf)
|
|||||||
char *ext;
|
char *ext;
|
||||||
|
|
||||||
debug_printf ("prog '%s'", prog);
|
debug_printf ("prog '%s'", prog);
|
||||||
buf.check (prog, PC_SYM_FOLLOW | PC_FULL, std_suffixes);
|
buf.check (prog, PC_SYM_FOLLOW, std_suffixes);
|
||||||
|
|
||||||
if (!buf.exists () || buf.isdir ())
|
if (!buf.exists () || buf.isdir ())
|
||||||
ext = NULL;
|
ext = NULL;
|
||||||
|
@ -134,7 +134,7 @@ unlink (const char *ourname)
|
|||||||
int res = -1;
|
int res = -1;
|
||||||
DWORD devn;
|
DWORD devn;
|
||||||
|
|
||||||
path_conv win32_name (ourname, PC_SYM_NOFOLLOW | PC_FULL);
|
path_conv win32_name (ourname, PC_SYM_NOFOLLOW);
|
||||||
|
|
||||||
if (win32_name.error)
|
if (win32_name.error)
|
||||||
{
|
{
|
||||||
@ -267,7 +267,7 @@ unlink (const char *ourname)
|
|||||||
extern "C" int
|
extern "C" int
|
||||||
_remove_r (struct _reent *, const char *ourname)
|
_remove_r (struct _reent *, const char *ourname)
|
||||||
{
|
{
|
||||||
path_conv win32_name (ourname, PC_SYM_NOFOLLOW | PC_FULL);
|
path_conv win32_name (ourname, PC_SYM_NOFOLLOW);
|
||||||
|
|
||||||
if (win32_name.error)
|
if (win32_name.error)
|
||||||
{
|
{
|
||||||
@ -282,7 +282,7 @@ _remove_r (struct _reent *, const char *ourname)
|
|||||||
extern "C" int
|
extern "C" int
|
||||||
remove (const char *ourname)
|
remove (const char *ourname)
|
||||||
{
|
{
|
||||||
path_conv win32_name (ourname, PC_SYM_NOFOLLOW | PC_FULL);
|
path_conv win32_name (ourname, PC_SYM_NOFOLLOW);
|
||||||
|
|
||||||
if (win32_name.error)
|
if (win32_name.error)
|
||||||
{
|
{
|
||||||
@ -1128,7 +1128,7 @@ rename (const char *oldpath, const char *newpath)
|
|||||||
int res = 0;
|
int res = 0;
|
||||||
char *lnk_suffix = NULL;
|
char *lnk_suffix = NULL;
|
||||||
|
|
||||||
path_conv real_old (oldpath, PC_FULL | PC_SYM_NOFOLLOW);
|
path_conv real_old (oldpath, PC_SYM_NOFOLLOW);
|
||||||
|
|
||||||
if (real_old.error)
|
if (real_old.error)
|
||||||
{
|
{
|
||||||
@ -1137,7 +1137,7 @@ rename (const char *oldpath, const char *newpath)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
path_conv real_new (newpath, PC_FULL | PC_SYM_NOFOLLOW);
|
path_conv real_new (newpath, PC_SYM_NOFOLLOW);
|
||||||
|
|
||||||
/* Shortcut hack. */
|
/* Shortcut hack. */
|
||||||
char new_lnk_buf[CYG_MAX_PATH + 5];
|
char new_lnk_buf[CYG_MAX_PATH + 5];
|
||||||
@ -1146,7 +1146,7 @@ rename (const char *oldpath, const char *newpath)
|
|||||||
strcpy (new_lnk_buf, newpath);
|
strcpy (new_lnk_buf, newpath);
|
||||||
strcat (new_lnk_buf, ".lnk");
|
strcat (new_lnk_buf, ".lnk");
|
||||||
newpath = new_lnk_buf;
|
newpath = new_lnk_buf;
|
||||||
real_new.check (newpath, PC_FULL | PC_SYM_NOFOLLOW);
|
real_new.check (newpath, PC_SYM_NOFOLLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (real_new.error || real_new.case_clash)
|
if (real_new.error || real_new.case_clash)
|
||||||
@ -1460,7 +1460,7 @@ pathconf (const char *file, int v)
|
|||||||
case _PC_POSIX_PERMISSIONS:
|
case _PC_POSIX_PERMISSIONS:
|
||||||
case _PC_POSIX_SECURITY:
|
case _PC_POSIX_SECURITY:
|
||||||
{
|
{
|
||||||
path_conv full_path (file, PC_SYM_FOLLOW | PC_FULL);
|
path_conv full_path (file, PC_SYM_FOLLOW);
|
||||||
if (full_path.error)
|
if (full_path.error)
|
||||||
{
|
{
|
||||||
set_errno (full_path.error);
|
set_errno (full_path.error);
|
||||||
@ -1719,7 +1719,7 @@ statvfs (const char *fname, struct statvfs *sfs)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
path_conv full_path (fname, PC_SYM_FOLLOW | PC_FULL);
|
path_conv full_path (fname, PC_SYM_FOLLOW);
|
||||||
if (!rootdir (full_path, root))
|
if (!rootdir (full_path, root))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -1910,7 +1910,7 @@ mknod32 (const char *path, mode_t mode, __dev32_t dev)
|
|||||||
if (strlen (path) >= CYG_MAX_PATH)
|
if (strlen (path) >= CYG_MAX_PATH)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
path_conv w32path (path, PC_SYM_NOFOLLOW | PC_FULL);
|
path_conv w32path (path, PC_SYM_NOFOLLOW);
|
||||||
if (w32path.exists ())
|
if (w32path.exists ())
|
||||||
{
|
{
|
||||||
set_errno (EEXIST);
|
set_errno (EEXIST);
|
||||||
@ -2247,7 +2247,7 @@ setregid (__gid16_t rgid, __gid16_t egid)
|
|||||||
extern "C" int
|
extern "C" int
|
||||||
chroot (const char *newroot)
|
chroot (const char *newroot)
|
||||||
{
|
{
|
||||||
path_conv path (newroot, PC_SYM_FOLLOW | PC_FULL | PC_POSIX);
|
path_conv path (newroot, PC_SYM_FOLLOW | PC_POSIX);
|
||||||
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
if (path.error)
|
if (path.error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user