Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/ptyfs - return an error if we could not get the pts p...



details:   https://anonhg.NetBSD.org/src/rev/d332f94a0075
branches:  trunk
changeset: 327873:d332f94a0075
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 19 18:09:00 2014 +0000

description:
- return an error if we could not get the pts pathname
- correct getting pathname if the mount point inside a chroot
(Ilya Zykov)

diffstat:

 sys/fs/ptyfs/ptyfs_vfsops.c |  20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diffs (60 lines):

diff -r 08d4339abddb -r d332f94a0075 sys/fs/ptyfs/ptyfs_vfsops.c
--- a/sys/fs/ptyfs/ptyfs_vfsops.c       Wed Mar 19 18:04:32 2014 +0000
+++ b/sys/fs/ptyfs/ptyfs_vfsops.c       Wed Mar 19 18:09:00 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptyfs_vfsops.c,v 1.45 2014/02/25 18:30:10 pooka Exp $  */
+/*     $NetBSD: ptyfs_vfsops.c,v 1.46 2014/03/19 18:09:00 christos Exp $       */
 
 /*
  * Copyright (c) 1992, 1993, 1995
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.45 2014/02/25 18:30:10 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.46 2014/03/19 18:09:00 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -109,14 +109,16 @@
        buf = malloc(MAXBUF, M_TEMP, M_WAITOK);
        bp = buf + MAXBUF;
        *--bp = '\0';
-       error = getcwd_common(cwdi->cwdi_rdir, rootvnode, &bp,
+       error = getcwd_common(mp->mnt_vnodecovered, cwdi->cwdi_rdir, &bp,
            buf, MAXBUF / 2, 0, l);
-       if (error)      /* XXX */
+       if (error) {    /* Mount point is out of rdir */
+               rv = NULL;
                goto out;
+       }
 
        len = strlen(bp);
        if (len < sizeof(mp->mnt_stat.f_mntonname))     /* XXX */
-               rv += len;
+               rv += strlen(rv) - len;
 out:
        free(buf, M_TEMP);
        return rv;
@@ -128,6 +130,7 @@
 {
        struct mount *mp = pt->arg;
        size_t len;
+       const char *np;
 
        switch (ms) {
        case 'p':
@@ -135,8 +138,11 @@
                len = snprintf(tbuf, bufsiz, "/dev/null");
                break;
        case 't':
-               len = snprintf(tbuf, bufsiz, "%s/%llu", ptyfs__getpath(l, mp),
-                   (unsigned long long)minor(dev));
+               np = ptyfs__getpath(l, mp);
+               if (np == NULL)
+                       return EOPNOTSUPP;
+               len = snprintf(tbuf, bufsiz, "%s/%llu", np,
+                       (unsigned long long)minor(dev));
                break;
        default:
                return EINVAL;



Home | Main Index | Thread Index | Old Index