]> git.proxmox.com Git - mirror_ovs.git/blobdiff - lib/socket-util-unix.c
dpif-netdev: Fix few comments.
[mirror_ovs.git] / lib / socket-util-unix.c
index 32f966d81fb91cd265f87903680be08148fcd5bc..59f63fcceb8782fc0ced210aac84dd390e23feaf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Nicira, Inc.
+ * Copyright (c) 2014, 2016 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -387,9 +387,10 @@ error:
 }
 
 int
-get_unix_name_len(socklen_t sun_len)
+get_unix_name_len(const struct sockaddr_un *sun, socklen_t sun_len)
 {
-    return (sun_len >= offsetof(struct sockaddr_un, sun_path)
+    return (sun_len > offsetof(struct sockaddr_un, sun_path) &&
+            sun->sun_path[0] != 0
             ? sun_len - offsetof(struct sockaddr_un, sun_path)
             : 0);
 }