Download raw body.
add gotctl(8)
On Sat, Oct 29, 2022 at 08:49:21PM +0200, Omar Polo wrote: > just a minor nitpick while reading the code: we could save a local > variable and some copying by just reusing the same variable. Sure, ok! > diff /home/op/w/got > commit - b6ef252ebaef7fa8a1bce4d12b51f735fb5e3e3f > path + /home/op/w/got > blob - 821e75bd339a40b002fc603fcf67ccd42e2a0578 > file + gotctl/gotctl.c > --- gotctl/gotctl.c > +++ gotctl/gotctl.c > @@ -341,20 +341,13 @@ connect_gotd(const char *socket_path) > connect_gotd(const char *socket_path) > { > const struct got_error *error = NULL; > - char unix_socket_path[PATH_MAX]; > int gotd_sock = -1; > struct sockaddr_un sun; > > - if (socket_path) { > - if (strlcpy(unix_socket_path, socket_path, > - sizeof(unix_socket_path)) >= sizeof(unix_socket_path)) > - errx(1, "gotd socket path too long"); > - } else { > - strlcpy(unix_socket_path, GOTD_UNIX_SOCKET, > - sizeof(unix_socket_path)); > - } > + if (socket_path == NULL) > + socket_path = GOTD_UNIX_SOCKET; > > - error = apply_unveil(unix_socket_path); > + error = apply_unveil(socket_path); > if (error) > errx(1, "%s", error->msg); > > @@ -367,11 +360,11 @@ connect_gotd(const char *socket_path) > > memset(&sun, 0, sizeof(sun)); > sun.sun_family = AF_UNIX; > - if (strlcpy(sun.sun_path, unix_socket_path, > - sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) > + if (strlcpy(sun.sun_path, socket_path, sizeof(sun.sun_path)) >= > + sizeof(sun.sun_path)) > errx(1, "gotd socket path too long"); > if (connect(gotd_sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) > - err(1, "connect: %s", unix_socket_path); > + err(1, "connect: %s", socket_path); > > #ifndef PROFILE > if (pledge("stdio", NULL) == -1) >
add gotctl(8)