mirror of
https://github.com/mirror/make.git
synced 2025-02-10 20:00:21 +08:00
* function.c(abspath): Use memcpy() to avoid GCC 8.1 warnings
This commit is contained in:
parent
63b42fa235
commit
0bc699a761
@ -2028,8 +2028,8 @@ func_not (char *o, char **argv, char *funcname UNUSED)
|
|||||||
# endif
|
# endif
|
||||||
# define ROOT_LEN 3
|
# define ROOT_LEN 3
|
||||||
#else
|
#else
|
||||||
#define IS_ABSOLUTE(n) (n[0] == '/')
|
# define IS_ABSOLUTE(n) (n[0] == '/')
|
||||||
#define ROOT_LEN 1
|
# define ROOT_LEN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Return the absolute name of file NAME which does not contain any '.',
|
/* Return the absolute name of file NAME which does not contain any '.',
|
||||||
@ -2042,7 +2042,7 @@ abspath (const char *name, char *apath)
|
|||||||
const char *start, *end, *apath_limit;
|
const char *start, *end, *apath_limit;
|
||||||
unsigned long root_len = ROOT_LEN;
|
unsigned long root_len = ROOT_LEN;
|
||||||
|
|
||||||
if (name[0] == '\0' || apath == NULL)
|
if (name[0] == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
apath_limit = apath + GET_PATH_MAX;
|
apath_limit = apath + GET_PATH_MAX;
|
||||||
@ -2081,7 +2081,7 @@ abspath (const char *name, char *apath)
|
|||||||
if (STOP_SET (name[0], MAP_DIRSEP))
|
if (STOP_SET (name[0], MAP_DIRSEP))
|
||||||
root_len = 1;
|
root_len = 1;
|
||||||
#endif
|
#endif
|
||||||
strncpy (apath, name, root_len);
|
memcpy (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. */
|
||||||
|
Loading…
Reference in New Issue
Block a user