projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
doc: use ASCII in .texi files where UTF-8 isn't needed
[gnulib.git]
/
lib
/
grantpt.c
diff --git
a/lib/grantpt.c
b/lib/grantpt.c
index
985e31d
..
cc29bc3
100644
(file)
--- a/
lib/grantpt.c
+++ b/
lib/grantpt.c
@@
-1,5
+1,5
@@
/* Acquire ownership of the slave side of a pseudo-terminal.
/* Acquire ownership of the slave side of a pseudo-terminal.
- Copyright (C) 1998-2002, 2009-201
1
Free Software Foundation, Inc.
+ Copyright (C) 1998-2002, 2009-201
4
Free Software Foundation, Inc.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
This program is free software: you can redistribute it and/or modify
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
This program is free software: you can redistribute it and/or modify
@@
-46,6
+46,11
@@
int
grantpt (int fd)
{
int
grantpt (int fd)
{
+#if defined __OpenBSD__
+ /* On OpenBSD, master and slave of a pseudo-terminal are allocated together,
+ through an ioctl on /dev/ptm. There is no need for grantpt(). */
+ return 0;
+#else
/* This function is most often called from a process without 'root'
credentials. Use the helper program. */
int retval = -1;
/* This function is most often called from a process without 'root'
credentials. Use the helper program. */
int retval = -1;
@@
-56,20
+61,20
@@
grantpt (int fd)
{
/* This is executed in the child process. */
{
/* This is executed in the child process. */
-#if HAVE_SETRLIMIT && defined RLIMIT_CORE
+#
if HAVE_SETRLIMIT && defined RLIMIT_CORE
/* Disable core dumps. */
struct rlimit rl = { 0, 0 };
__setrlimit (RLIMIT_CORE, &rl);
/* Disable core dumps. */
struct rlimit rl = { 0, 0 };
__setrlimit (RLIMIT_CORE, &rl);
-#endif
+#
endif
/* We pass the master pseudo terminal as file descriptor PTY_FILENO. */
if (fd != PTY_FILENO)
if (__dup2 (fd, PTY_FILENO) < 0)
_exit (FAIL_EBADF);
/* We pass the master pseudo terminal as file descriptor PTY_FILENO. */
if (fd != PTY_FILENO)
if (__dup2 (fd, PTY_FILENO) < 0)
_exit (FAIL_EBADF);
-#ifdef CLOSE_ALL_FDS
+#
ifdef CLOSE_ALL_FDS
CLOSE_ALL_FDS ();
CLOSE_ALL_FDS ();
-#endif
+#
endif
execle (_PATH_PT_CHOWN, strrchr (_PATH_PT_CHOWN, '/') + 1, NULL, NULL);
_exit (FAIL_EXEC);
execle (_PATH_PT_CHOWN, strrchr (_PATH_PT_CHOWN, '/') + 1, NULL, NULL);
_exit (FAIL_EXEC);
@@
-111,4
+116,5
@@
grantpt (int fd)
cleanup:
return retval;
cleanup:
return retval;
+#endif
}
}