mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Return -1 not NULL on error. Doh.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: osdep-darwin.c,v 1.5 2009-02-09 18:08:01 nicm Exp $ */
 | 
					/* $Id: osdep-darwin.c,v 1.6 2009-02-09 18:09:58 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
 | 
					 * Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
 | 
				
			||||||
@@ -43,12 +43,12 @@ osdep_get_name(int fd, unused char *tty, unused pid_t *last_pid, char **name)
 | 
				
			|||||||
	struct kinfo_proc kp;
 | 
						struct kinfo_proc kp;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if ((mib[3] = tcgetpgrp(fd)) == -1)
 | 
						if ((mib[3] = tcgetpgrp(fd)) == -1)
 | 
				
			||||||
		return (NULL);
 | 
							return (-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size = sizeof kp;
 | 
						size = sizeof kp;
 | 
				
			||||||
	if (sysctl(mib, 4, &kp, &size, NULL, 0) == -1 ||
 | 
						if (sysctl(mib, 4, &kp, &size, NULL, 0) == -1 ||
 | 
				
			||||||
	    kp.kp_proc.p_comm[0] == '\0')
 | 
						    kp.kp_proc.p_comm[0] == '\0')
 | 
				
			||||||
		return (NULL);
 | 
							return (-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return (strdup(kp.kp_proc.p_comm));
 | 
						return (strdup(kp.kp_proc.p_comm));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: osdep-freebsd.c,v 1.12 2009-02-09 18:08:01 nicm Exp $ */
 | 
					/* $Id: osdep-freebsd.c,v 1.13 2009-02-09 18:09:58 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -55,18 +55,18 @@ osdep_get_name(int fd, char *tty, pid_t *last_pid, char **name)
 | 
				
			|||||||
	buf = NULL;
 | 
						buf = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (stat(tty, &sb) == -1)
 | 
						if (stat(tty, &sb) == -1)
 | 
				
			||||||
		return (NULL);
 | 
							return (-1);
 | 
				
			||||||
	if ((mib[3] = tcgetpgrp(fd)) == -1)
 | 
						if ((mib[3] = tcgetpgrp(fd)) == -1)
 | 
				
			||||||
		return (NULL);
 | 
							return (-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
retry:
 | 
					retry:
 | 
				
			||||||
	if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) == -1)
 | 
						if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) == -1)
 | 
				
			||||||
		return (NULL);
 | 
							return (-1);
 | 
				
			||||||
	len = (len * 5) / 4;
 | 
						len = (len * 5) / 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((newbuf = realloc(buf, len)) == NULL) {
 | 
						if ((newbuf = realloc(buf, len)) == NULL) {
 | 
				
			||||||
		free(buf);
 | 
							free(buf);
 | 
				
			||||||
		return (NULL);
 | 
							return (-1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	buf = newbuf;
 | 
						buf = newbuf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -74,7 +74,7 @@ retry:
 | 
				
			|||||||
		if (errno == ENOMEM)
 | 
							if (errno == ENOMEM)
 | 
				
			||||||
			goto retry;
 | 
								goto retry;
 | 
				
			||||||
		free(buf);
 | 
							free(buf);
 | 
				
			||||||
		return (NULL);
 | 
							return (-1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bestp = NULL;
 | 
						bestp = NULL;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user