mirror of
https://github.com/mirror/make.git
synced 2025-03-26 20:10:15 +08:00
Fix $abspath on Cygwin when HAVE_DOS_PATHS is in effect.
function.c (IS_ABSOLUTE) [__CYGWIN__]: Special definition for Cygwin. (abspath) [__CYGWIN__]: Reset root_len to 1 if the absolute file name has the Posix /foo/bar form. [HAVE_DOS_PATHS]: Use root_len instead of hard-coded 2.
This commit is contained in:
parent
1d4c15b4e1
commit
f8786092ad
@ -1,3 +1,12 @@
|
|||||||
|
2013-10-02 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
|
Fix $abspath on Cygwin when HAVE_DOS_PATHS is in effect.
|
||||||
|
* function.c (IS_ABSOLUTE) [__CYGWIN__]: Special definition for
|
||||||
|
Cygwin.
|
||||||
|
(abspath) [__CYGWIN__]: Reset root_len to 1 if the absolute file
|
||||||
|
name has the Posix /foo/bar form.
|
||||||
|
[HAVE_DOS_PATHS]: Use root_len instead of hard-coded 2.
|
||||||
|
|
||||||
2013-10-01 Paul Smith <psmith@gnu.org>
|
2013-10-01 Paul Smith <psmith@gnu.org>
|
||||||
|
|
||||||
* configure.ac: Update version to 3.99.93.
|
* configure.ac: Update version to 3.99.93.
|
||||||
|
12
function.c
12
function.c
@ -1949,7 +1949,11 @@ func_not (char *o, char **argv, char *funcname UNUSED)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DOS_PATHS
|
#ifdef HAVE_DOS_PATHS
|
||||||
|
# ifdef __CYGWIN__
|
||||||
|
# define IS_ABSOLUTE(n) ((n[0] && n[1] == ':') || STOP_SET (n[0], MAP_PATHSEP))
|
||||||
|
# else
|
||||||
# define IS_ABSOLUTE(n) (n[0] && n[1] == ':')
|
# define IS_ABSOLUTE(n) (n[0] && n[1] == ':')
|
||||||
|
# endif
|
||||||
# define ROOT_LEN 3
|
# define ROOT_LEN 3
|
||||||
#else
|
#else
|
||||||
#define IS_ABSOLUTE(n) (n[0] == '/')
|
#define IS_ABSOLUTE(n) (n[0] == '/')
|
||||||
@ -2001,13 +2005,17 @@ abspath (const char *name, char *apath)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
if (STOP_SET (name[0], MAP_PATHSEP))
|
||||||
|
root_len = 1;
|
||||||
|
#endif
|
||||||
strncpy (apath, name, root_len);
|
strncpy (apath, name, root_len);
|
||||||
apath[root_len] = '\0';
|
apath[root_len] = '\0';
|
||||||
dest = apath + root_len;
|
dest = apath + root_len;
|
||||||
/* Get past the root, since we already copied it. */
|
/* Get past the root, since we already copied it. */
|
||||||
name += root_len;
|
name += root_len;
|
||||||
#ifdef HAVE_DOS_PATHS
|
#ifdef HAVE_DOS_PATHS
|
||||||
if (! STOP_SET (apath[2], MAP_PATHSEP))
|
if (! STOP_SET (apath[root_len - 1], MAP_PATHSEP))
|
||||||
{
|
{
|
||||||
/* Convert d:foo into d:./foo and increase root_len. */
|
/* Convert d:foo into d:./foo and increase root_len. */
|
||||||
apath[2] = '.';
|
apath[2] = '.';
|
||||||
@ -2018,7 +2026,7 @@ abspath (const char *name, char *apath)
|
|||||||
name--;
|
name--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
apath[2] = '/'; /* make sure it's a forward slash */
|
apath[root_len - 1] = '/'; /* make sure it's a forward slash */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user