Wed Mar 26 21:29:54 2014 UTC ()
in the bsdpty allocvp flavor, call the bsdpty mkname directly, since it is
the only one possible to be valid (Ilya Zykov)


(christos)
diff -r1.17 -r1.18 src/sys/kern/tty_bsdpty.c

cvs diff -r1.17 -r1.18 src/sys/kern/tty_bsdpty.c (expand / switch to unified diff)

--- src/sys/kern/tty_bsdpty.c 2010/11/19 06:44:43 1.17
+++ src/sys/kern/tty_bsdpty.c 2014/03/26 21:29:54 1.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tty_bsdpty.c,v 1.17 2010/11/19 06:44:43 dholland Exp $ */ 1/* $NetBSD: tty_bsdpty.c,v 1.18 2014/03/26 21:29:54 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2004 The NetBSD Foundation, Inc. 4 * Copyright (c) 2004 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: tty_bsdpty.c,v 1.17 2010/11/19 06:44:43 dholland Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: tty_bsdpty.c,v 1.18 2014/03/26 21:29:54 christos Exp $");
31 31
32#include "opt_ptm.h" 32#include "opt_ptm.h"
33 33
34#ifdef COMPAT_BSDPTY 34#ifdef COMPAT_BSDPTY
35/* bsd tty implementation for pty multiplexor driver /dev/ptm{,x} */ 35/* bsd tty implementation for pty multiplexor driver /dev/ptm{,x} */
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include <sys/lwp.h> 40#include <sys/lwp.h>
41#include <sys/tty.h> 41#include <sys/tty.h>
42#include <sys/stat.h> 42#include <sys/stat.h>
43#include <sys/file.h> 43#include <sys/file.h>
@@ -111,27 +111,27 @@ pty_makename(struct ptm_pty *ptm, struct @@ -111,27 +111,27 @@ pty_makename(struct ptm_pty *ptm, struct
111} 111}
112 112
113 113
114static int 114static int
115/*ARGSUSED*/ 115/*ARGSUSED*/
116pty_allocvp(struct ptm_pty *ptm, struct lwp *l, struct vnode **vp, dev_t dev, 116pty_allocvp(struct ptm_pty *ptm, struct lwp *l, struct vnode **vp, dev_t dev,
117 char ms) 117 char ms)
118{ 118{
119 int error; 119 int error;
120 struct pathbuf *pb; 120 struct pathbuf *pb;
121 struct nameidata nd; 121 struct nameidata nd;
122 char name[TTY_NAMESIZE]; 122 char name[TTY_NAMESIZE];
123 123
124 error = (*ptm->makename)(ptm, l, name, sizeof(name), dev, ms); 124 error = pty_makename(ptm, l, name, sizeof(name), dev, ms);
125 if (error) 125 if (error)
126 return error; 126 return error;
127 127
128 pb = pathbuf_create(name); 128 pb = pathbuf_create(name);
129 if (pb == NULL) { 129 if (pb == NULL) {
130 return ENOMEM; 130 return ENOMEM;
131 } 131 }
132 132
133 NDINIT(&nd, LOOKUP, NOFOLLOW|LOCKLEAF, pb); 133 NDINIT(&nd, LOOKUP, NOFOLLOW|LOCKLEAF, pb);
134 if ((error = namei(&nd)) != 0) { 134 if ((error = namei(&nd)) != 0) {
135 pathbuf_destroy(pb); 135 pathbuf_destroy(pb);
136 return error; 136 return error;
137 } 137 }