diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-06-16 15:58:07 -0700 |
---|---|---|
committer | Andreas Schwab <schwab@redhat.com> | 2009-08-04 10:57:56 +0200 |
commit | a7800930627c2ee5d4d3b373f62c897e0c321c19 (patch) | |
tree | 0706ba10078a6836b166464e3ee181c82f922f2e /sysdeps | |
parent | a584fc6a6b81183ed6ce1724237c6744cdd6559e (diff) |
Extend pt_chown to drop privileges.
If libcap is available, use it to drop privileges in pt_chown before
starting the work to change the permissions and ownership of the
slave device.
(cherry picked from commit f793b62438a3cfdbcc5ba453eebee1db3f315bea)
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/pty-private.h | 5 | ||||
-rw-r--r-- | sysdeps/unix/grantpt.c | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/generic/pty-private.h b/sysdeps/generic/pty-private.h index d6ec2cee68..493f40551d 100644 --- a/sysdeps/generic/pty-private.h +++ b/sysdeps/generic/pty-private.h @@ -1,5 +1,5 @@ /* Internal defenitions and declarations for pseudo terminal functions. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998. @@ -39,7 +39,8 @@ enum /* failure modes */ FAIL_EBADF = 1, FAIL_EINVAL, FAIL_EACCES, - FAIL_EXEC + FAIL_EXEC, + FAIL_ENOMEM }; #endif /* pty-private.h */ diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c index bdedbacec8..39797841c5 100644 --- a/sysdeps/unix/grantpt.c +++ b/sysdeps/unix/grantpt.c @@ -185,7 +185,7 @@ grantpt (int fd) if (!WIFEXITED (w)) __set_errno (ENOEXEC); else - switch (WEXITSTATUS(w)) + switch (WEXITSTATUS (w)) { case 0: retval = 0; @@ -202,6 +202,9 @@ grantpt (int fd) case FAIL_EXEC: __set_errno (ENOEXEC); break; + case FAIL_ENOMEM: + __set_errno (ENOMEM); + break; default: assert(! "getpt: internal error: invalid exit code from pt_chown"); |