X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fvconn-unix.c;h=b1a7d8a75ef77fc153cb34680d056ee8358dab20;hb=20360221fb53e0bda3570ae2e3a89536620345c4;hp=9b08b10efbdd9ebf49bf7d25a80be8866e1a3d49;hpb=f593e3ab70ab06acbf97cbb0a9f897dc4f078011;p=sliver-openvswitch.git diff --git a/lib/vconn-unix.c b/lib/vconn-unix.c index 9b08b10ef..b1a7d8a75 100644 --- a/lib/vconn-unix.c +++ b/lib/vconn-unix.c @@ -44,7 +44,7 @@ #include #include #include "ofpbuf.h" -#include "openflow.h" +#include "openflow/openflow.h" #include "packets.h" #include "poll-loop.h" #include "socket-util.h" @@ -114,12 +114,11 @@ punix_accept(int fd, const struct sockaddr *sa, size_t sa_len, struct vconn **vconnp) { const struct sockaddr_un *sun = (const struct sockaddr_un *) sa; + int name_len = get_unix_name_len(sa_len); char name[128]; - if (sa_len >= offsetof(struct sockaddr_un, sun_path)) { - snprintf(name, sizeof name, "unix:%.*s", - (int) (sa_len - offsetof(struct sockaddr_un, sun_path)), - sun->sun_path); + if (name_len > 0) { + snprintf(name, sizeof name, "unix:%.*s", name_len, sun->sun_path); } else { strcpy(name, "unix"); }