mirror of
https://github.com/tmux/tmux.git
synced 2025-01-14 12:48:56 +00:00
Call fstat() after fopen() rather than stat() before.
This commit is contained in:
parent
539c73bdb1
commit
6b804f3a4a
@ -56,13 +56,14 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
if ((s = cmd_find_session(ctx, data->target)) == NULL)
|
||||
return (-1);
|
||||
|
||||
if (stat(data->arg, &sb) < 0) {
|
||||
if ((f = fopen(data->arg, "rb")) == NULL) {
|
||||
ctx->error(ctx, "%s: %s", data->arg, strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((f = fopen(data->arg, "rb")) == NULL) {
|
||||
if (fstat(fileno(f), &sb) < 0) {
|
||||
ctx->error(ctx, "%s: %s", data->arg, strerror(errno));
|
||||
fclose(f);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user