summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-05-15 19:03:17 +0000
committerRoland McGrath <roland@gnu.org>1999-05-15 19:03:17 +0000
commitfb327b1f8d4ee990fa08c162c5ffbb6f9a720e89 (patch)
tree9e4deda2ec4e7ef7988028d6aeda1a07af3f15c2
parentd5dfcb2d559f9c78f0b6ec08d6c0c7887126daf2 (diff)
1999-05-13 Roland McGrath <roland@baalperazim.frob.com>
* users.c (trivfs_S_file_chown): Either arg being -1 means don't change that id.
-rw-r--r--term/users.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/term/users.c b/term/users.c
index 9f2a3eff..67730052 100644
--- a/term/users.c
+++ b/term/users.c
@@ -476,8 +476,8 @@ trivfs_S_file_chown (struct trivfs_protid *cred,
if (err)
goto out;
- if (!idvec_contains (cred->user->uids, uid)
- || !idvec_contains (cred->user->gids, gid))
+ if ((uid != (uid_t) -1 && !idvec_contains (cred->user->uids, uid))
+ || (gid != (gid_t) -1 && !idvec_contains (cred->user->gids, gid)))
{
err = EPERM;
goto out;
@@ -485,8 +485,10 @@ trivfs_S_file_chown (struct trivfs_protid *cred,
}
/* Make the change */
- term_owner = uid;
- term_group = gid;
+ if (uid != (uid_t) -1)
+ term_owner = uid;
+ if (gid != (gid_t) -1)
+ term_group = gid;
err = 0;
out:
@@ -2198,14 +2200,14 @@ S_term_get_peername (io_t arg,
{
struct trivfs_protid *cred = ports_lookup_port (term_bucket, arg, 0);
struct trivfs_control *peer;
-
+
if (!cred || (cred->pi.class != tty_class && cred->pi.class != pty_class))
{
if (cred)
ports_port_deref (cred);
return EOPNOTSUPP;
}
-
+
peer = (cred->pi.class == tty_class) ? ptyctl : termctl;
if (bottom != &ptyio_bottom || !peer->hook)
@@ -2213,7 +2215,7 @@ S_term_get_peername (io_t arg,
ports_port_deref (cred);
return ENOENT;
}
-
+
strcpy (name, (char *) peer->hook);
ports_port_deref (cred);