summaryrefslogtreecommitdiff
path: root/app/xconsole/xconsole.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2007-09-13 21:15:17 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2007-09-13 21:15:17 +0000
commite9bdc24ad7c749611474016dc7cc003c139a90ac (patch)
treee003080a47220cef8d8f3693692e88fc7c04a82b /app/xconsole/xconsole.c
parentbb15588b00a2ec2ede393fc484d5b56f9ee3864b (diff)
merge xconsole 1.0.3
Diffstat (limited to 'app/xconsole/xconsole.c')
-rw-r--r--app/xconsole/xconsole.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/xconsole/xconsole.c b/app/xconsole/xconsole.c
index e3b67cf24..095cd5cc5 100644
--- a/app/xconsole/xconsole.c
+++ b/app/xconsole/xconsole.c
@@ -73,13 +73,13 @@ extern char *_XawTextGetSTRING(TextWidget ctx, XawTextPosition left,
# include <pty.h>
# endif
#endif
-#ifdef USE_PRIVSEP
-# include <pwd.h>
-#endif
+#ifdef USE_PRIVSEP
+#include <pwd.h>
extern int priv_init(uid_t, gid_t);
extern int priv_openpty(int *, int *);
extern int priv_set_console(int);
+#endif
/* Fix ISC brain damage. When using gcc fdopen isn't declared in <stdio.h>. */
#if defined(ISC) && __STDC__ && !defined(ISC30)
@@ -294,14 +294,13 @@ OpenConsole(void)
{
# ifdef TIOCCONS
int on = 1;
-#ifdef USE_PRIVSEP
+# ifdef USE_PRIVSEP
if (priv_set_console(tty_fd) != -1)
input = fdopen (pty_fd, "r");
-#else
+# else
if (ioctl (tty_fd, TIOCCONS, (char *) &on) != -1)
input = fdopen (pty_fd, "r");
-#endif
-
+# endif
# else
# ifndef Lynx
int consfd = open("/dev/console", O_RDONLY);
@@ -670,7 +669,6 @@ main(int argc, char *argv[])
{
Arg arglist[10];
Cardinal num_args;
-
#ifdef USE_PRIVSEP
struct passwd *pw;
#endif
@@ -680,6 +678,7 @@ main(int argc, char *argv[])
&argc, argv);
XtGetApplicationResources (top, (XtPointer)&app_resources, resources,
XtNumber (resources), NULL, 0);
+
#ifdef USE_PRIVSEP
/* Revoke privileges if any */
if (getuid() == 0) {