diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2020-12-08 15:50:23 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2020-12-08 15:50:23 +0300 |
commit | 07e4587d4f2e0ffe1a36c41b95e0a25fc74ca789 (patch) | |
tree | 142c599a4bf298b985a3d35b4d1536a82984ef85 /voidnsundo.c | |
parent | cc24315bfd72ce0c2a275e54869b8fe77a655a46 (diff) |
add comments to the code
Diffstat (limited to 'voidnsundo.c')
-rw-r--r-- | voidnsundo.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/voidnsundo.c b/voidnsundo.c index 6720b8d..9639d51 100644 --- a/voidnsundo.c +++ b/voidnsundo.c @@ -80,7 +80,10 @@ int main(int argc, char **argv) struct sockaddr_un sock_addr = {0}; sock_addr.sun_family = AF_UNIX; - strncpy(sock_addr.sun_path, SOCK_PATH, 108); + + /* The size of sun_path is 108 bytes, our SOCK_PATH is definitely + * smaller. */ + strcpy(sock_addr.sun_path, SOCK_PATH); if (connect(sock_fd, (struct sockaddr *)&sock_addr, sizeof(sock_addr)) == -1) ERROR_EXIT("connect: %s\n", strerror(errno)); @@ -89,6 +92,7 @@ int main(int argc, char **argv) if (!nsfd) ERROR_EXIT("error: failed to get nsfd.\n"); + /* Change namespace. */ if (setns(nsfd, CLONE_NEWNS) == -1) ERROR_EXIT("setns: %s.\n", strerror(errno)); |