aboutsummaryrefslogtreecommitdiff
path: root/pty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2017-02-15 08:54:21 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2017-02-15 08:54:21 +0000
commit36734afdd8f0cf0daa664b8448728cdff0ca1550 (patch)
treef19bc6b78c907aa0cca71c4454ce9a13bbe99cd7 /pty.c
parent2b4c144f9687f996e4ebf464614506fb90092f82 (diff)
downloadrtmux-36734afdd8f0cf0daa664b8448728cdff0ca1550.tar.gz
rtmux-36734afdd8f0cf0daa664b8448728cdff0ca1550.tar.bz2
rtmux-36734afdd8f0cf0daa664b8448728cdff0ca1550.zip
Hide or fix some warnings.
Diffstat (limited to 'pty.c')
-rw-r--r--pty.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/pty.c b/pty.c
index 012e2f1c..44f609de 100644
--- a/pty.c
+++ b/pty.c
@@ -33,23 +33,28 @@
int pty_open(int *);
pid_t pty_fork(int, int *, char *, size_t, struct winsize *);
+#ifdef __OpenBSD__
int
pty_open(int *fd)
{
-#ifdef __OpenBSD__
*fd = open(PATH_PTMDEV, O_RDWR|O_CLOEXEC);
if (*fd < 0)
return (-1);
+ return (0);
+}
#else
+int
+pty_open(__unused int *fd)
+{
*fd = -1;
-#endif
return (0);
}
+#endif
+#ifdef __OpenBSD__
pid_t
pty_fork(int ptmfd, int *fd, char *name, size_t namelen, struct winsize *ws)
{
-#ifdef __OpenBSD__
struct ptmget ptm;
pid_t pid;
@@ -72,7 +77,12 @@ pty_fork(int ptmfd, int *fd, char *name, size_t namelen, struct winsize *ws)
*fd = ptm.cfd;
close(ptm.sfd);
return (pid);
+}
#else
+pid_t
+pty_fork(__unused int ptmfd, int *fd, char *name, __unused size_t namelen,
+ struct winsize *ws)
+{
return (forkpty(fd, name, NULL, ws));
-#endif
}
+#endif