]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* function.c(abspath): Use memcpy() to avoid GCC 8.1 warnings
authorPaul Smith <psmith@nuodb.com>
Sun, 1 Jul 2018 19:32:49 +0000 (15:32 -0400)
committerPaul Smith <psmith@gnu.org>
Mon, 2 Jul 2018 11:54:07 +0000 (07:54 -0400)
src/function.c

index 89b7113db3fcba73092fff3c47066c7f842b96b4..3d97998efb8790f840b2358f9b98bacbd851326c 100644 (file)
@@ -2028,8 +2028,8 @@ func_not (char *o, char **argv, char *funcname UNUSED)
 # endif
 # define ROOT_LEN 3
 #else
-#define IS_ABSOLUTE(n) (n[0] == '/')
-#define ROOT_LEN 1
+# define IS_ABSOLUTE(n) (n[0] == '/')
+# define ROOT_LEN 1
 #endif
 
 /* 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;
   unsigned long root_len = ROOT_LEN;
 
-  if (name[0] == '\0' || apath == NULL)
+  if (name[0] == '\0')
     return NULL;
 
   apath_limit = apath + GET_PATH_MAX;
@@ -2081,7 +2081,7 @@ abspath (const char *name, char *apath)
       if (STOP_SET (name[0], MAP_DIRSEP))
         root_len = 1;
 #endif
-      strncpy (apath, name, root_len);
+      memcpy (apath, name, root_len);
       apath[root_len] = '\0';
       dest = apath + root_len;
       /* Get past the root, since we already copied it.  */