mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 11:18:48 +00:00
Reset the umask right after fopen to avoid leaving it changed on error, noticed
by deraadt@.
This commit is contained in:
parent
6dc6333323
commit
539c73bdb1
@ -70,6 +70,7 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
f = fopen(data->arg, "ab");
|
f = fopen(data->arg, "ab");
|
||||||
else
|
else
|
||||||
f = fopen(data->arg, "wb");
|
f = fopen(data->arg, "wb");
|
||||||
|
umask(mask);
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
ctx->error(ctx, "%s: %s", data->arg, strerror(errno));
|
ctx->error(ctx, "%s: %s", data->arg, strerror(errno));
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -82,7 +83,6 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
umask(mask);
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user