mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Fill in osdep_get_cwd on Darwin, from Alex Ernst.
This commit is contained in:
		@@ -20,6 +20,7 @@
 | 
				
			|||||||
#include <sys/sysctl.h>
 | 
					#include <sys/sysctl.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <event.h>
 | 
					#include <event.h>
 | 
				
			||||||
 | 
					#include <libproc.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
@@ -52,6 +53,16 @@ osdep_get_name(int fd, unused char *tty)
 | 
				
			|||||||
char *
 | 
					char *
 | 
				
			||||||
osdep_get_cwd(pid_t pid)
 | 
					osdep_get_cwd(pid_t pid)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						static char 			wd[PATH_MAX];
 | 
				
			||||||
 | 
						struct proc_vnodepathinfo	pathinfo;
 | 
				
			||||||
 | 
						int				ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ret = proc_pidinfo(
 | 
				
			||||||
 | 
						    pid, PROC_PIDVNODEPATHINFO, 0, &pathinfo, sizeof pathinfo);
 | 
				
			||||||
 | 
						if (ret == sizeof pathinfo) {
 | 
				
			||||||
 | 
							strlcpy(wd, pathinfo.pvi_cdir.vip_path, sizeof wd);
 | 
				
			||||||
 | 
							return (wd);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return (NULL);
 | 
						return (NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user