windows: fix the most egregious posix.c style errors
[fio.git] / iolog.c
diff --git a/iolog.c b/iolog.c
index f3eedb56252c9b177c2f75d2d50e9a99a2b59696..26c3458638adf94f41d407c5444187e64f299647 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -580,7 +580,10 @@ static int open_socket(const char *path)
        if (fd < 0)
                return fd;
        addr.sun_family = AF_UNIX;
-       strncpy(addr.sun_path, path, sizeof(addr.sun_path));
+       if (snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path) >=
+           sizeof(addr.sun_path))
+               log_err("%s: path name %s is too long for a Unix socket\n",
+                       __func__, path);
        if (connect(fd, (const struct sockaddr *)&addr, strlen(path) + sizeof(addr.sun_family)) == 0)
                return fd;
        else