mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Sync OpenBSD patchset 1135:
Do not crash when the current session has no window, fixes a bug reported by Giorgio Lando. Fix from Thomas Adam.
This commit is contained in:
		
							
								
								
									
										4
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								cmd.c
									
									
									
									
									
								
							@@ -1289,7 +1289,7 @@ cmd_get_default_path(struct cmd_ctx *ctx, const char *cwd)
 | 
				
			|||||||
		/* Session working directory. */
 | 
							/* Session working directory. */
 | 
				
			||||||
		root = s->cwd;
 | 
							root = s->cwd;
 | 
				
			||||||
		goto complete_path;
 | 
							goto complete_path;
 | 
				
			||||||
	} else if (cwd[0] == '.' && (cwd[1] == '\0' || cwd[1] == '/')){
 | 
						} else if (cwd[0] == '.' && (cwd[1] == '\0' || cwd[1] == '/')) {
 | 
				
			||||||
		/* Server working directory. */
 | 
							/* Server working directory. */
 | 
				
			||||||
		if (getcwd(tmp, sizeof tmp) != NULL) {
 | 
							if (getcwd(tmp, sizeof tmp) != NULL) {
 | 
				
			||||||
			root = tmp;
 | 
								root = tmp;
 | 
				
			||||||
@@ -1303,7 +1303,7 @@ cmd_get_default_path(struct cmd_ctx *ctx, const char *cwd)
 | 
				
			|||||||
		/* Empty or relative path. */
 | 
							/* Empty or relative path. */
 | 
				
			||||||
		if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL)
 | 
							if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL)
 | 
				
			||||||
			root = ctx->cmdclient->cwd;
 | 
								root = ctx->cmdclient->cwd;
 | 
				
			||||||
		else if (ctx->curclient != NULL)
 | 
							else if (ctx->curclient != NULL && s->curw != NULL)
 | 
				
			||||||
			root = osdep_get_cwd(s->curw->window->active->pid);
 | 
								root = osdep_get_cwd(s->curw->window->active->pid);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			return (s->cwd);
 | 
								return (s->cwd);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user