mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Call fstat() after fopen() rather than stat() before.
This commit is contained in:
		@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user