* path.h (path_conv): Make path_flags private. Rename known_suffix to
suffix and make private. Rename normalized_path to posix_path and make privtae. Accommodate name changes throughout in path_conv methods. (path_conv::known_suffix): New method. Use throughout instead of accessing suffix directly. (path_conv::get_win32): Constify. (path_conv::get_posix): New method to read posix_path. Use throughout instead of accessing normalized_path directly. (path_conv::set_posix): Rename from set_normalized_path. Accommodate name change throughout. * spawn.cc (find_exec): Return POSIX path, not Win32 path.
This commit is contained in:
parent
6b14f3988c
commit
d2bd82aa92
@ -1,7 +1,7 @@
|
||||
/* dtable.cc: file descriptor support.
|
||||
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
|
||||
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@ -452,9 +452,9 @@ build_fh_dev (const device& dev, const char *unix_name)
|
||||
{
|
||||
path_conv pc (dev);
|
||||
if (unix_name)
|
||||
pc.set_normalized_path (unix_name);
|
||||
pc.set_posix (unix_name);
|
||||
else
|
||||
pc.set_normalized_path (dev.name);
|
||||
pc.set_posix (dev.name);
|
||||
return build_fh_pc (pc);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* fhandler.h
|
||||
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
|
||||
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@ -196,7 +196,7 @@ class fhandler_base
|
||||
virtual void set_name (path_conv &pc);
|
||||
virtual void set_name (const char *s)
|
||||
{
|
||||
pc.set_normalized_path (s);
|
||||
pc.set_posix (s);
|
||||
pc.set_path (s);
|
||||
}
|
||||
int error () const {return pc.error;}
|
||||
@ -295,7 +295,7 @@ class fhandler_base
|
||||
bool isremote () { return pc.isremote (); }
|
||||
|
||||
bool has_attribute (DWORD x) const {return pc.has_attribute (x);}
|
||||
const char *get_name () const { return pc.normalized_path; }
|
||||
const char *get_name () const { return pc.get_posix (); }
|
||||
const char *get_win32_name () { return pc.get_win32 (); }
|
||||
virtual dev_t get_dev () { return get_device (); }
|
||||
ino_t get_ino () { return ino ?: ino = hash_path_name (0, pc.get_nt_native_path ()); }
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* fhandler_disk_file.cc
|
||||
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
|
||||
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@ -258,7 +258,7 @@ path_conv::ndisk_links (DWORD nNumberOfLinks)
|
||||
bool first = true;
|
||||
PFILE_BOTH_DIR_INFORMATION fdibuf = (PFILE_BOTH_DIR_INFORMATION)
|
||||
alloca (65536);
|
||||
__DIR_mounts *dir = new __DIR_mounts (normalized_path);
|
||||
__DIR_mounts *dir = new __DIR_mounts (get_posix ());
|
||||
while (NT_SUCCESS (NtQueryDirectoryFile (fh, NULL, NULL, NULL, &io, fdibuf,
|
||||
65536, FileBothDirectoryInformation,
|
||||
FALSE, NULL, first)))
|
||||
@ -2110,7 +2110,7 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err,
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
char *file = tp.c_get ();
|
||||
char *p = stpcpy (file, pc.normalized_path);
|
||||
char *p = stpcpy (file, pc.get_posix ());
|
||||
if (p[-1] != '/')
|
||||
*p++ = '/';
|
||||
sys_wcstombs (p, NT_MAX_PATH - (p - file),
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* fhandler_registry.cc: fhandler for /proc/registry virtual filesystem
|
||||
|
||||
Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
|
||||
2013 Red Hat, Inc.
|
||||
2013, 2015 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@ -452,12 +452,12 @@ out:
|
||||
void
|
||||
fhandler_registry::set_name (path_conv &in_pc)
|
||||
{
|
||||
if (strncasematch (in_pc.normalized_path, "/proc/registry32", 16))
|
||||
if (strncasematch (in_pc.get_posix (), "/proc/registry32", 16))
|
||||
{
|
||||
wow64 = KEY_WOW64_32KEY;
|
||||
prefix_len += 2;
|
||||
}
|
||||
else if (strncasematch (in_pc.normalized_path, "/proc/registry64", 16))
|
||||
else if (strncasematch (in_pc.get_posix (), "/proc/registry64", 16))
|
||||
{
|
||||
wow64 = KEY_WOW64_64KEY;
|
||||
prefix_len += 2;
|
||||
|
@ -335,7 +335,7 @@ normalize_posix_path (const char *src, char *dst, char *&tail)
|
||||
So we replace dst with what we found in head
|
||||
instead. All the work replacing symlinks has been
|
||||
done in that path anyway, so why repeat it? */
|
||||
tail = stpcpy (dst, head.normalized_path);
|
||||
tail = stpcpy (dst, head.get_posix ());
|
||||
}
|
||||
check_parent = false;
|
||||
}
|
||||
@ -373,9 +373,9 @@ path_conv::add_ext_from_sym (symlink_info &sym)
|
||||
{
|
||||
if (sym.ext_here && *sym.ext_here)
|
||||
{
|
||||
known_suffix = path + sym.extn;
|
||||
suffix = path + sym.extn;
|
||||
if (sym.ext_tacked_on)
|
||||
strcpy ((char *) known_suffix, sym.ext_here);
|
||||
strcpy ((char *) suffix, sym.ext_here);
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,13 +409,13 @@ mkrelpath (char *path, bool caseinsensitive)
|
||||
}
|
||||
|
||||
void
|
||||
path_conv::set_normalized_path (const char *path_copy)
|
||||
path_conv::set_posix (const char *path_copy)
|
||||
{
|
||||
if (path_copy)
|
||||
{
|
||||
size_t n = strlen (path_copy) + 1;
|
||||
char *p = (char *) crealloc_abort ((void *) normalized_path, n);
|
||||
normalized_path = (const char *) memcpy (p, path_copy, n);
|
||||
char *p = (char *) crealloc_abort ((void *) posix_path, n);
|
||||
posix_path = (const char *) memcpy (p, path_copy, n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -659,7 +659,7 @@ path_conv::check (const char *src, unsigned opt,
|
||||
{
|
||||
int loop = 0;
|
||||
path_flags = 0;
|
||||
known_suffix = NULL;
|
||||
suffix = NULL;
|
||||
fileattr = INVALID_FILE_ATTRIBUTES;
|
||||
caseinsensitive = OBJ_CASE_INSENSITIVE;
|
||||
if (wide_path)
|
||||
@ -673,10 +673,10 @@ path_conv::check (const char *src, unsigned opt,
|
||||
close_conv_handle ();
|
||||
memset (&dev, 0, sizeof (dev));
|
||||
fs.clear ();
|
||||
if (normalized_path)
|
||||
if (posix_path)
|
||||
{
|
||||
cfree ((void *) normalized_path);
|
||||
normalized_path = NULL;
|
||||
cfree ((void *) posix_path);
|
||||
posix_path = NULL;
|
||||
}
|
||||
int component = 0; // Number of translated components
|
||||
|
||||
@ -1230,7 +1230,7 @@ path_conv::check (const char *src, unsigned opt,
|
||||
{
|
||||
if (tail < path_end && tail > path_copy + 1)
|
||||
*tail = '/';
|
||||
set_normalized_path (path_copy);
|
||||
set_posix (path_copy);
|
||||
if (is_msdos && dos_file_warning && !(opt & PC_NOWARN))
|
||||
warn_msdos (src);
|
||||
}
|
||||
@ -1252,10 +1252,10 @@ path_conv::check (const char *src, unsigned opt,
|
||||
|
||||
path_conv::~path_conv ()
|
||||
{
|
||||
if (normalized_path)
|
||||
if (posix_path)
|
||||
{
|
||||
cfree ((void *) normalized_path);
|
||||
normalized_path = NULL;
|
||||
cfree ((void *) posix_path);
|
||||
posix_path = NULL;
|
||||
}
|
||||
if (path)
|
||||
{
|
||||
@ -1623,10 +1623,10 @@ symlink_native (const char *oldpath, path_conv &win32_newpath)
|
||||
/* The symlink target is relative to the directory in which
|
||||
the symlink gets created, not relative to the cwd. Therefore
|
||||
we have to mangle the path quite a bit before calling path_conv. */
|
||||
ssize_t len = strrchr (win32_newpath.normalized_path, '/')
|
||||
- win32_newpath.normalized_path + 1;
|
||||
ssize_t len = strrchr (win32_newpath.get_posix (), '/')
|
||||
- win32_newpath.get_posix () + 1;
|
||||
char *absoldpath = tp.t_get ();
|
||||
stpcpy (stpncpy (absoldpath, win32_newpath.normalized_path, len),
|
||||
stpcpy (stpncpy (absoldpath, win32_newpath.get_posix (), len),
|
||||
oldpath);
|
||||
win32_oldpath.check (absoldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||
|
||||
@ -1860,10 +1860,10 @@ symlink_worker (const char *oldpath, const char *newpath, bool isdevice)
|
||||
stat_suffixes);
|
||||
else
|
||||
{
|
||||
len = strrchr (win32_newpath.normalized_path, '/')
|
||||
- win32_newpath.normalized_path + 1;
|
||||
len = strrchr (win32_newpath.get_posix (), '/')
|
||||
- win32_newpath.get_posix () + 1;
|
||||
char *absoldpath = tp.t_get ();
|
||||
stpcpy (stpncpy (absoldpath, win32_newpath.normalized_path,
|
||||
stpcpy (stpncpy (absoldpath, win32_newpath.get_posix (),
|
||||
len),
|
||||
oldpath);
|
||||
win32_oldpath.check (absoldpath, PC_SYM_NOFOLLOW,
|
||||
@ -3243,16 +3243,16 @@ chdir (const char *in_dir)
|
||||
{
|
||||
/* The sequence chdir("xx"); chdir(".."); must be a noop if xx
|
||||
is not a symlink. This is exploited by find.exe.
|
||||
The posix_cwd is just path.normalized_path.
|
||||
The posix_cwd is just path.get_posix ().
|
||||
In other cases we let cwd.set obtain the Posix path through
|
||||
the mount table. */
|
||||
if (!isdrive(path.normalized_path))
|
||||
posix_cwd = path.normalized_path;
|
||||
if (!isdrive (path.get_posix ()))
|
||||
posix_cwd = path.get_posix ();
|
||||
res = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
posix_cwd = path.normalized_path;
|
||||
posix_cwd = path.get_posix ();
|
||||
res = 0;
|
||||
}
|
||||
|
||||
@ -3579,11 +3579,11 @@ realpath (const char *__restrict path, char *__restrict resolved)
|
||||
if (!resolved)
|
||||
{
|
||||
resolved = (char *)
|
||||
malloc (strlen (real_path.normalized_path) + 1);
|
||||
malloc (strlen (real_path.get_posix ()) + 1);
|
||||
if (!resolved)
|
||||
return NULL;
|
||||
}
|
||||
strcpy (resolved, real_path.normalized_path);
|
||||
strcpy (resolved, real_path.get_posix ());
|
||||
return resolved;
|
||||
}
|
||||
|
||||
@ -3670,7 +3670,7 @@ conv_path_list_buf_size (const char *path_list, bool to_posix)
|
||||
/* 100: slop */
|
||||
size = strlen (path_list)
|
||||
+ (num_elms * max_mount_path_len)
|
||||
+ (nrel * strlen (to_posix ? pc.normalized_path : pc.get_win32 ()))
|
||||
+ (nrel * strlen (to_posix ? pc.get_posix () : pc.get_win32 ()))
|
||||
+ 100;
|
||||
|
||||
return size;
|
||||
|
@ -144,14 +144,15 @@ class path_conv
|
||||
void add_ext_from_sym (symlink_info&);
|
||||
DWORD symlink_length;
|
||||
const char *path;
|
||||
unsigned path_flags;
|
||||
const char *suffix;
|
||||
const char *posix_path;
|
||||
path_conv_handle conv_handle;
|
||||
public:
|
||||
unsigned path_flags;
|
||||
const char *known_suffix;
|
||||
const char *normalized_path;
|
||||
int error;
|
||||
device dev;
|
||||
|
||||
const char *known_suffix () { return suffix; }
|
||||
bool isremote () const {return fs.is_remote_drive ();}
|
||||
ULONG objcaseinsensitive () const {return caseinsensitive;}
|
||||
bool has_acls () const {return !(path_flags & PATH_NOACL) && fs.has_acls (); }
|
||||
@ -232,7 +233,7 @@ class path_conv
|
||||
|
||||
path_conv (const device& in_dev)
|
||||
: fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path (NULL),
|
||||
path_flags (0), known_suffix (NULL), normalized_path (NULL), error (0),
|
||||
path_flags (0), suffix (NULL), posix_path (NULL), error (0),
|
||||
dev (in_dev)
|
||||
{
|
||||
set_path (in_dev.native);
|
||||
@ -241,7 +242,7 @@ class path_conv
|
||||
path_conv (int, const char *src, unsigned opt = PC_SYM_FOLLOW,
|
||||
const suffix_info *suffixes = NULL)
|
||||
: fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path (NULL),
|
||||
path_flags (0), known_suffix (NULL), normalized_path (NULL), error (0)
|
||||
path_flags (0), suffix (NULL), posix_path (NULL), error (0)
|
||||
{
|
||||
check (src, opt, suffixes);
|
||||
}
|
||||
@ -249,7 +250,7 @@ class path_conv
|
||||
path_conv (const UNICODE_STRING *src, unsigned opt = PC_SYM_FOLLOW,
|
||||
const suffix_info *suffixes = NULL)
|
||||
: fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path (NULL),
|
||||
path_flags (0), known_suffix (NULL), normalized_path (NULL), error (0)
|
||||
path_flags (0), suffix (NULL), posix_path (NULL), error (0)
|
||||
{
|
||||
check (src, opt | PC_NULLEMPTY, suffixes);
|
||||
}
|
||||
@ -257,18 +258,18 @@ class path_conv
|
||||
path_conv (const char *src, unsigned opt = PC_SYM_FOLLOW,
|
||||
const suffix_info *suffixes = NULL)
|
||||
: fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path (NULL),
|
||||
path_flags (0), known_suffix (NULL), normalized_path (NULL), error (0)
|
||||
path_flags (0), suffix (NULL), posix_path (NULL), error (0)
|
||||
{
|
||||
check (src, opt | PC_NULLEMPTY, suffixes);
|
||||
}
|
||||
|
||||
path_conv ()
|
||||
: fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path (NULL),
|
||||
path_flags (0), known_suffix (NULL), normalized_path (NULL), error (0)
|
||||
path_flags (0), suffix (NULL), posix_path (NULL), error (0)
|
||||
{}
|
||||
|
||||
~path_conv ();
|
||||
inline const char *get_win32 () { return path; }
|
||||
inline const char *get_win32 () const { return path; }
|
||||
PUNICODE_STRING get_nt_native_path ();
|
||||
inline POBJECT_ATTRIBUTES get_object_attr (OBJECT_ATTRIBUTES &attr,
|
||||
SECURITY_ATTRIBUTES &sa)
|
||||
@ -309,17 +310,17 @@ class path_conv
|
||||
void free_strings ()
|
||||
{
|
||||
cfree_and_null (path);
|
||||
cfree_and_null (normalized_path);
|
||||
cfree_and_null (posix_path);
|
||||
cfree_and_null (wide_path);
|
||||
}
|
||||
path_conv& eq_worker (const path_conv& pc, const char *in_path,
|
||||
const char *in_normalized_path)
|
||||
const char *in_posix_path)
|
||||
{
|
||||
free_strings ();
|
||||
memcpy (this, &pc, sizeof pc);
|
||||
path = cstrdup (in_path);
|
||||
conv_handle.dup (pc.conv_handle);
|
||||
normalized_path = cstrdup(pc.normalized_path);
|
||||
posix_path = cstrdup(pc.posix_path);
|
||||
if (pc.wide_path)
|
||||
{
|
||||
wide_path = cwcsdup (uni_path.Buffer);
|
||||
@ -333,7 +334,7 @@ class path_conv
|
||||
path_conv &operator << (const path_conv& pc)
|
||||
{
|
||||
const char *save_path;
|
||||
const char *save_normalized_path;
|
||||
const char *save_posix_path;
|
||||
if (!path)
|
||||
save_path = pc.path;
|
||||
else
|
||||
@ -341,19 +342,19 @@ class path_conv
|
||||
save_path = (char *) alloca (strlen (path) + 1);
|
||||
strcpy ((char *) save_path, path);
|
||||
}
|
||||
if (!normalized_path)
|
||||
save_normalized_path = pc.normalized_path;
|
||||
if (!posix_path)
|
||||
save_posix_path = pc.posix_path;
|
||||
else
|
||||
{
|
||||
save_normalized_path = (char *) alloca (strlen (normalized_path) + 1);
|
||||
strcpy ((char *) save_normalized_path, path);
|
||||
save_posix_path = (char *) alloca (strlen (posix_path) + 1);
|
||||
strcpy ((char *) save_posix_path, path);
|
||||
}
|
||||
return eq_worker (pc, save_path, save_normalized_path);
|
||||
return eq_worker (pc, save_path, save_posix_path);
|
||||
}
|
||||
|
||||
path_conv &operator =(const path_conv& pc)
|
||||
{
|
||||
return eq_worker (pc, pc.path, pc.normalized_path);
|
||||
return eq_worker (pc, pc.path, pc.posix_path);
|
||||
}
|
||||
dev_t get_device () {return dev.get_device ();}
|
||||
DWORD file_attributes () const {return fileattr;}
|
||||
@ -395,7 +396,8 @@ class path_conv
|
||||
#if 0 /* obsolete, method still exists in fhandler_disk_file.cc */
|
||||
unsigned __stdcall ndisk_links (DWORD);
|
||||
#endif
|
||||
void __reg2 set_normalized_path (const char *);
|
||||
inline const char *get_posix () const { return posix_path; }
|
||||
void __reg2 set_posix (const char *);
|
||||
DWORD get_symlink_length () { return symlink_length; };
|
||||
private:
|
||||
char *modifiable_path () {return (char *) path;}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* pipe.cc: pipe for Cygwin.
|
||||
|
||||
Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
2008, 2009, 2010, 2011, 2012, 2013 Hat, Inc.
|
||||
2008, 2009, 2010, 2011, 2012, 2013, 2015 Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@ -412,9 +412,9 @@ pipe_worker (int filedes[2], unsigned int psize, int mode)
|
||||
cygheap_fdnew fdout (fdin, false);
|
||||
char buf[sizeof ("/dev/fd/pipe:[2147483647]")];
|
||||
__small_sprintf (buf, "/dev/fd/pipe:[%d]", (int) fdin);
|
||||
fhs[0]->pc.set_normalized_path (buf);
|
||||
fhs[0]->pc.set_posix (buf);
|
||||
__small_sprintf (buf, "pipe:[%d]", (int) fdout);
|
||||
fhs[1]->pc.set_normalized_path (buf);
|
||||
fhs[1]->pc.set_posix (buf);
|
||||
fdin = fhs[0];
|
||||
fdout = fhs[1];
|
||||
filedes[0] = fdin;
|
||||
|
@ -66,8 +66,8 @@ perhaps_suffix (const char *prog, path_conv& buf, int& err, unsigned opt)
|
||||
err = ENOENT;
|
||||
ext = NULL;
|
||||
}
|
||||
else if (buf.known_suffix)
|
||||
ext = buf.get_win32 () + (buf.known_suffix - buf.get_win32 ());
|
||||
else if (buf.known_suffix ())
|
||||
ext = buf.get_win32 () + (buf.known_suffix () - buf.get_win32 ());
|
||||
else
|
||||
ext = strchr (buf.get_win32 (), '\0');
|
||||
|
||||
@ -77,9 +77,9 @@ perhaps_suffix (const char *prog, path_conv& buf, int& err, unsigned opt)
|
||||
|
||||
/* Find an executable name, possibly by appending known executable suffixes
|
||||
to it. The path_conv struct 'buf' is filled and contains both, win32 and
|
||||
posix path of the file.. Any found suffix is returned in known_suffix.
|
||||
posix path of the file. Any found suffix is returned in known_suffix.
|
||||
|
||||
If the file is not found and !FE_NNF then the win32 version of name is
|
||||
If the file is not found and !FE_NNF then the POSIX version of name is
|
||||
placed in buf and returned. Otherwise the contents of buf is undefined
|
||||
and NULL is returned. */
|
||||
const char * __reg3
|
||||
@ -100,7 +100,7 @@ find_exec (const char *name, path_conv& buf, const char *search,
|
||||
if ((has_slash || opt & FE_CWD)
|
||||
&& (suffix = perhaps_suffix (name, buf, err, opt)) != NULL)
|
||||
{
|
||||
retval = buf.get_win32 ();
|
||||
retval = buf.get_posix ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ find_exec (const char *name, path_conv& buf, const char *search,
|
||||
{
|
||||
if (buf.has_acls () && check_file_access (buf, X_OK, true))
|
||||
continue;
|
||||
retval = buf.get_win32 ();
|
||||
retval = buf.get_posix ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -151,11 +151,11 @@ find_exec (const char *name, path_conv& buf, const char *search,
|
||||
if (!(opt & FE_NNF))
|
||||
{
|
||||
buf.check (name, PC_SYM_FOLLOW | PC_POSIX);
|
||||
retval = buf.get_win32 ();
|
||||
retval = buf.get_posix ();
|
||||
}
|
||||
|
||||
out:
|
||||
debug_printf ("%s = find_exec (%s)", (char *) buf.get_win32 (), name);
|
||||
debug_printf ("%s = find_exec (%s)", (char *) buf.get_posix (), name);
|
||||
if (known_suffix)
|
||||
*known_suffix = suffix ?: strchr (buf.get_win32 (), '\0');
|
||||
if (!retval && err)
|
||||
@ -1201,7 +1201,7 @@ av::setup (const char *prog_arg, path_conv& real_path, const char *ext,
|
||||
unshift (arg1);
|
||||
|
||||
find_exec (pgm, real_path, "PATH", FE_NADA, &ext);
|
||||
unshift (real_path.normalized_path);
|
||||
unshift (real_path.get_posix ());
|
||||
}
|
||||
if (real_path.iscygexec ())
|
||||
dup_all ();
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* syscalls.cc: syscalls
|
||||
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
|
||||
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@ -2201,7 +2201,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
set_errno (ENOTDIR);
|
||||
__leave;
|
||||
}
|
||||
if (oldpc.known_suffix
|
||||
if (oldpc.known_suffix ()
|
||||
&& (ascii_strcasematch (oldpath + olen - 4, ".lnk")
|
||||
|| ascii_strcasematch (oldpath + olen - 4, ".exe")))
|
||||
old_explicit_suffix = true;
|
||||
@ -2248,7 +2248,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
set_errno (newpc.isdir () ? EISDIR : ENOTDIR);
|
||||
__leave;
|
||||
}
|
||||
if (newpc.known_suffix
|
||||
if (newpc.known_suffix ()
|
||||
&& (ascii_strcasematch (newpath + nlen - 4, ".lnk")
|
||||
|| ascii_strcasematch (newpath + nlen - 4, ".exe")))
|
||||
new_explicit_suffix = true;
|
||||
@ -2313,7 +2313,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
&ro_u_lnk, TRUE))
|
||||
rename_append_suffix (newpc, newpath, nlen, ".lnk");
|
||||
else if (oldpc.is_binary () && !old_explicit_suffix
|
||||
&& oldpc.known_suffix
|
||||
&& oldpc.known_suffix ()
|
||||
&& !nt_path_has_executable_suffix
|
||||
(newpc.get_nt_native_path ()))
|
||||
/* Never append .exe suffix if oldpath had .exe suffix given
|
||||
@ -2353,7 +2353,7 @@ rename (const char *oldpath, const char *newpath)
|
||||
explicitely, or if newfile is a binary (in which case the given
|
||||
name probably makes sense as it is), or if the destination
|
||||
filename has one of the blessed executable suffixes. */
|
||||
if (!old_explicit_suffix && oldpc.known_suffix
|
||||
if (!old_explicit_suffix && oldpc.known_suffix ()
|
||||
&& !newpc.is_binary ()
|
||||
&& !nt_path_has_executable_suffix
|
||||
(newpc.get_nt_native_path ()))
|
||||
@ -3664,7 +3664,7 @@ chroot (const char *newroot)
|
||||
else
|
||||
{
|
||||
getwinenv("PATH="); /* Save the native PATH */
|
||||
cygheap->root.set (path.normalized_path, path.get_win32 (),
|
||||
cygheap->root.set (path.get_posix (), path.get_win32 (),
|
||||
!!path.objcaseinsensitive ());
|
||||
ret = 0;
|
||||
}
|
||||
@ -4714,7 +4714,7 @@ linkat (int olddirfd, const char *oldpathname,
|
||||
set_errno (old_name.error);
|
||||
__leave;
|
||||
}
|
||||
strcpy (oldpath, old_name.normalized_path);
|
||||
strcpy (oldpath, old_name.get_posix ());
|
||||
}
|
||||
return link (oldpath, newpath);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user