]> git.proxmox.com Git - mirror_ovs.git/commitdiff
dpctl: Fix broken Windows build due to missing strndup.
authorIlya Maximets <i.maximets@ovn.org>
Wed, 6 Jan 2021 15:29:26 +0000 (16:29 +0100)
committerIlya Maximets <i.maximets@ovn.org>
Wed, 6 Jan 2021 18:07:08 +0000 (19:07 +0100)
AppVeyor reports:

  lib/dpctl.c(1433): error C4013: 'strndup' undefined;
                                  assuming extern returning int
  make[2]: *** [lib/dpctl.lo] Error 1

Replacing missing 'strndup' with a portable pair of functions.

Fixes: bf8812cd7e20 ("dpctl: Add add/mod/del-flows command.")
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
lib/dpctl.c

index 408f9807580707f31ba5cd1c039f7de7eb06eb4b..d43e0a7fe99995e898bea76b78b2615d14015e9d 100644 (file)
@@ -1430,7 +1430,8 @@ dpctl_parse_flow_line(int command, struct ds *s, char **flow, char **action)
         return command;
     }
 
-    *flow = strndup(line, len);
+    *flow = xzalloc(len + 1);
+    ovs_strlcpy(*flow, line, len + 1);
 
     line += len;
     line += strspn(line, " \t\r\n");