1
0
Fork 0
forked from murx/murx

Umask fix.

This commit is contained in:
Johannes Findeisen 2026-11-15 09:07:25 +01:00
commit 8bae4bbfdc
2 changed files with 13 additions and 5 deletions

View file

@ -45,6 +45,11 @@ option, restart the session server once so it understands the prefix setting.
centred in its terminal, while a smaller client shows the top-left part. centred in its terminal, while a smaller client shows the top-left part.
`Ctrl-A R` forces the session back to the current client's terminal size. `Ctrl-A R` forces the session back to the current client's terminal size.
- Panes run `$SHELL` as a login shell with `TERM=screen-256color`. - Panes run `$SHELL` as a login shell with `TERM=screen-256color`.
They inherit the launching process's umask, so builds keep their usual file
permissions. After upgrading from a version that forced `077`, restart the
session server to apply the fix. In an existing shell, `umask 022` restores
typical public file permissions for subsequent commands, including builds
published with `rsync -a`.
- Window names show `hostname:program` for the foreground program in their - Window names show `hostname:program` for the foreground program in their
active pane (for example `laptop:zsh` or `laptop:vim`), refreshed active pane (for example `laptop:zsh` or `laptop:vim`), refreshed
every second, including in inactive windows. When a program exits, the name every second, including in inactive windows. When a program exits, the name

13
moerx.c
View file

@ -3415,8 +3415,6 @@ static void server_start(const char *path, const char *name, int readyfd) {
sigaction(SIGINT, &sa, NULL); sigaction(SIGINT, &sa, NULL);
sigaction(SIGQUIT, &sa, NULL); sigaction(SIGQUIT, &sa, NULL);
umask(077);
int lfd = socket(AF_UNIX, SOCK_STREAM, 0); int lfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (lfd < 0) { if (lfd < 0) {
server_fail(readyfd, "socket", errno); server_fail(readyfd, "socket", errno);
@ -3427,10 +3425,15 @@ static void server_start(const char *path, const char *name, int readyfd) {
saun.sun_family = AF_UNIX; saun.sun_family = AF_UNIX;
snprintf(saun.sun_path, sizeof saun.sun_path, "%s", path); snprintf(saun.sun_path, sizeof saun.sun_path, "%s", path);
unlink(path); unlink(path);
if (bind(lfd, (struct sockaddr *)&saun, sizeof saun) < 0) { /* Protect the socket without imposing private file permissions on pane
int err = errno; shells and their build output (rsync -a preserves those permissions). */
mode_t saved_umask = umask(077);
int bound = bind(lfd, (struct sockaddr *)&saun, sizeof saun);
int bind_err = errno;
umask(saved_umask);
if (bound < 0) {
close(lfd); close(lfd);
server_fail(readyfd, "bind", err); server_fail(readyfd, "bind", bind_err);
_exit(1); _exit(1);
} }
if (listen(lfd, 16) < 0) { if (listen(lfd, 16) < 0) {