about summary refs log tree commit diff
path: root/sysdeps/unix/grantpt.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-06-16 15:58:07 -0700
committerUlrich Drepper <drepper@redhat.com>2009-06-16 15:58:07 -0700
commitf793b62438a3cfdbcc5ba453eebee1db3f315bea (patch)
treec0c8cf38a5c5293bfc05af20ab797e2496137158 /sysdeps/unix/grantpt.c
parentfab8238de69de67637d21923b3ec1c26e4ce8450 (diff)
downloadglibc-f793b62438a3cfdbcc5ba453eebee1db3f315bea.tar.gz
glibc-f793b62438a3cfdbcc5ba453eebee1db3f315bea.tar.xz
glibc-f793b62438a3cfdbcc5ba453eebee1db3f315bea.zip
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.
Diffstat (limited to 'sysdeps/unix/grantpt.c')
-rw-r--r--sysdeps/unix/grantpt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c
index f664b9eb1b..8c299e9147 100644
--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -202,7 +202,7 @@ grantpt (int fd)
       if (!WIFEXITED (w))
 	__set_errno (ENOEXEC);
       else
-	switch (WEXITSTATUS(w))
+	switch (WEXITSTATUS (w))
 	  {
 	  case 0:
 	    retval = 0;
@@ -219,6 +219,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");