Umask fix.
This commit is contained in:
parent
51016fd2f1
commit
8bae4bbfdc
2 changed files with 13 additions and 5 deletions
|
|
@ -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.
|
||||
`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`.
|
||||
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
|
||||
active pane (for example `laptop:zsh` or `laptop:vim`), refreshed
|
||||
every second, including in inactive windows. When a program exits, the name
|
||||
|
|
|
|||
13
moerx.c
13
moerx.c
|
|
@ -3415,8 +3415,6 @@ static void server_start(const char *path, const char *name, int readyfd) {
|
|||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGQUIT, &sa, NULL);
|
||||
|
||||
umask(077);
|
||||
|
||||
int lfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (lfd < 0) {
|
||||
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;
|
||||
snprintf(saun.sun_path, sizeof saun.sun_path, "%s", path);
|
||||
unlink(path);
|
||||
if (bind(lfd, (struct sockaddr *)&saun, sizeof saun) < 0) {
|
||||
int err = errno;
|
||||
/* Protect the socket without imposing private file permissions on pane
|
||||
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);
|
||||
server_fail(readyfd, "bind", err);
|
||||
server_fail(readyfd, "bind", bind_err);
|
||||
_exit(1);
|
||||
}
|
||||
if (listen(lfd, 16) < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue