summaryrefslogtreecommitdiff
path: root/tools/virtual.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/virtual.c')
-rw-r--r--tools/virtual.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/virtual.c b/tools/virtual.c
index b51c81a1..d16a55f9 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -2387,10 +2387,8 @@ static int bumblebee_open(struct context *ctx)
}
addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path,
- optarg && *optarg ? optarg : "/var/run/bumblebee.socket",
- sizeof(addr.sun_path)-1);
- addr.sun_path[sizeof(addr.sun_path)-1] = '\0';
+ snprintf(addr.sun_path, sizeof(addr.sun_path), "%s",
+ optarg && *optarg ? optarg : "/var/run/bumblebee.socket");
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
DBG(X11, ("%s unable to create a socket: %d\n", __func__, errno));
goto err;