summaryrefslogtreecommitdiffstats
path: root/osdep-sunos.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-10-15 07:11:25 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-10-15 07:11:25 +0000
commit0614ca434a6ff0995ea52b1852cc4639252931cb (patch)
treea3c849aba40d213e6bcb6acd6f1e589cd48345b0 /osdep-sunos.c
parent8085adb8a2129098d71a159abb8bd42074badb91 (diff)
Fill in the tty name in SunOS's forkpty compat, and use it in osdep_getname.
From Todd Carson. Tweaked by me to nuke (void) casts. Say no to lint appeasement! ;-)
Diffstat (limited to 'osdep-sunos.c')
-rw-r--r--osdep-sunos.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/osdep-sunos.c b/osdep-sunos.c
index a1abcbff..d2681d04 100644
--- a/osdep-sunos.c
+++ b/osdep-sunos.c
@@ -1,4 +1,4 @@
-/* $Id: osdep-sunos.c,v 1.1 2009-10-14 10:14:21 nicm Exp $ */
+/* $Id: osdep-sunos.c,v 1.2 2009-10-15 07:11:25 nicm Exp $ */
/*
* Copyright (c) 2009 Todd Carson <toc@daybefore.net>
@@ -28,7 +28,7 @@
#include "tmux.h"
char *
-osdep_get_name(int fd, unused char *tty)
+osdep_get_name(int fd, char *tty)
{
struct psinfo p;
struct stat st;
@@ -37,18 +37,15 @@ osdep_get_name(int fd, unused char *tty)
int f;
pid_t pgrp;
- if ((path = ptsname(fd)) == NULL)
- return (NULL);
-
- if ((f = open(path, O_RDONLY)) < 0)
+ if ((f = open(tty, O_RDONLY)) < 0)
return (NULL);
if ((fstat(f, &st) != 0) ||
(ioctl(f, TIOCGPGRP, &pgrp) != 0)) {
- (void) close(f);
+ close(f);
return (NULL);
}
- (void) close(f);
+ close(f);
xasprintf(&path, "/proc/%hu/psinfo", pgrp);
f = open(path, O_RDONLY);
@@ -57,7 +54,7 @@ osdep_get_name(int fd, unused char *tty)
return (NULL);
bytes = read(f, &p, sizeof(p));
- (void) close(f);
+ close(f);
if (bytes != sizeof(p))
return (NULL);