Fix white space/indentation to match X.Org style.
This commit is contained in:
parent
a009af0b91
commit
6b14cdf954
@ -254,23 +254,23 @@ xf86OpenConsole(void)
|
|||||||
case PCVT:
|
case PCVT:
|
||||||
#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000))
|
#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000))
|
||||||
/*
|
/*
|
||||||
* First activate the #1 VT. This is a hack to allow a server
|
* First activate the #1 VT. This is a hack to allow a server
|
||||||
* to be started while another one is active. There should be
|
* to be started while another one is active. There should be
|
||||||
* a better way.
|
* a better way.
|
||||||
*/
|
*/
|
||||||
if (initialVT != 1) {
|
if (initialVT != 1) {
|
||||||
|
|
||||||
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0) {
|
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0) {
|
||||||
xf86Msg(X_WARNING,
|
xf86Msg(X_WARNING,
|
||||||
"xf86OpenConsole: VT_ACTIVATE failed\n");
|
"xf86OpenConsole: VT_ACTIVATE failed\n");
|
||||||
}
|
}
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||||
acquire_vt:
|
acquire_vt:
|
||||||
#endif
|
#endif
|
||||||
if (!xf86Info.ShareVTs) {
|
if (!xf86Info.ShareVTs) {
|
||||||
/*
|
/*
|
||||||
* now get the VT
|
* now get the VT
|
||||||
*/
|
*/
|
||||||
@ -286,7 +286,7 @@ acquire_vt:
|
|||||||
}
|
}
|
||||||
|
|
||||||
signal(SIGUSR2, xf86VTRequest);
|
signal(SIGUSR2, xf86VTRequest);
|
||||||
|
|
||||||
vtmode.mode = VT_PROCESS;
|
vtmode.mode = VT_PROCESS;
|
||||||
vtmode.relsig = SIGUSR2;
|
vtmode.relsig = SIGUSR2;
|
||||||
vtmode.acqsig = SIGUSR2;
|
vtmode.acqsig = SIGUSR2;
|
||||||
@ -303,11 +303,11 @@ acquire_vt:
|
|||||||
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
|
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
|
||||||
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
|
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* xf86Info.ShareVTs */
|
else { /* xf86Info.ShareVTs */
|
||||||
close(xf86Info.consoleFd);
|
close(xf86Info.consoleFd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
|
#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
|
||||||
#ifdef WSCONS_SUPPORT
|
#ifdef WSCONS_SUPPORT
|
||||||
case WSCONS:
|
case WSCONS:
|
||||||
@ -432,60 +432,60 @@ xf86OpenSyscons(void)
|
|||||||
#if 0
|
#if 0
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (xf86Info.vtno == -1) {
|
if (xf86Info.vtno == -1) {
|
||||||
/*
|
/*
|
||||||
* All VTs are in use. If initialVT was found, use it.
|
* All VTs are in use. If initialVT was found, use it.
|
||||||
*/
|
*/
|
||||||
if (initialVT != -1) {
|
if (initialVT != -1) {
|
||||||
xf86Info.vtno = initialVT;
|
xf86Info.vtno = initialVT;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (syscons_version >= 0x100) {
|
if (syscons_version >= 0x100) {
|
||||||
FatalError("%s: Cannot find a free VT",
|
FatalError("%s: Cannot find a free VT",
|
||||||
"xf86OpenSyscons");
|
"xf86OpenSyscons");
|
||||||
}
|
}
|
||||||
/* Should no longer reach here */
|
/* Should no longer reach here */
|
||||||
FatalError("%s: %s %s\n\t%s %s",
|
FatalError("%s: %s %s\n\t%s %s",
|
||||||
"xf86OpenSyscons",
|
"xf86OpenSyscons",
|
||||||
"syscons versions prior to 1.0 require",
|
"syscons versions prior to 1.0 require",
|
||||||
"either the",
|
"either the",
|
||||||
"server's stdin be a VT",
|
"server's stdin be a VT",
|
||||||
"or the use of the vtxx server option");
|
"or the use of the vtxx server option");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
from = X_PROBED;
|
from = X_PROBED;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
#ifndef __OpenBSD__
|
#ifndef __OpenBSD__
|
||||||
snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 1);
|
snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 1);
|
||||||
#else
|
#else
|
||||||
sprintf(vtname, sizeof(vtname), "/dev/ttyC%01x", xf86Info.vtno - 1);
|
sprintf(vtname, sizeof(vtname), "/dev/ttyC%01x", xf86Info.vtno - 1);
|
||||||
#endif
|
#endif
|
||||||
if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) {
|
if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) {
|
||||||
FatalError("xf86OpenSyscons: Cannot open %s (%s)",
|
FatalError("xf86OpenSyscons: Cannot open %s (%s)",
|
||||||
vtname, strerror(errno));
|
vtname, strerror(errno));
|
||||||
}
|
}
|
||||||
if (ioctl(fd, VT_GETMODE, &vtmode) < 0) {
|
if (ioctl(fd, VT_GETMODE, &vtmode) < 0) {
|
||||||
FatalError("xf86OpenSyscons: VT_GETMODE failed");
|
FatalError("xf86OpenSyscons: VT_GETMODE failed");
|
||||||
}
|
}
|
||||||
xf86Info.consType = SYSCONS;
|
xf86Info.consType = SYSCONS;
|
||||||
xf86Msg(X_PROBED, "Using syscons driver with X support");
|
xf86Msg(X_PROBED, "Using syscons driver with X support");
|
||||||
if (syscons_version >= 0x100) {
|
if (syscons_version >= 0x100) {
|
||||||
xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8,
|
xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8,
|
||||||
syscons_version & 0xFF);
|
syscons_version & 0xFF);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
xf86ErrorF(" (version 0.x)\n");
|
xf86ErrorF(" (version 0.x)\n");
|
||||||
}
|
}
|
||||||
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
|
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* VT_GETMODE failed, probably not syscons */
|
/* VT_GETMODE failed, probably not syscons */
|
||||||
close(fd);
|
close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
@ -511,11 +511,11 @@ xf86OpenPcvt(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (VTnum != -1) {
|
if (VTnum != -1) {
|
||||||
snprintf(vtname, sizeof(vtname), "%s%x", vtprefix, VTnum - 1);
|
snprintf(vtname, sizeof(vtname), "%s%x", vtprefix, VTnum - 1);
|
||||||
fd = open(vtname, PCVT_CONSOLE_MODE, 0);
|
fd = open(vtname, PCVT_CONSOLE_MODE, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
|
fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
|
||||||
}
|
}
|
||||||
#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV
|
#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
@ -524,55 +524,55 @@ xf86OpenPcvt(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) {
|
if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) {
|
||||||
if(ioctl(fd, VT_GETMODE, &vtmode) < 0) {
|
if(ioctl(fd, VT_GETMODE, &vtmode) < 0) {
|
||||||
FatalError("%s: VT_GETMODE failed\n%s%s\n%s",
|
FatalError("%s: VT_GETMODE failed\n%s%s\n%s",
|
||||||
"xf86OpenPcvt",
|
"xf86OpenPcvt",
|
||||||
"Found pcvt driver but X11 seems to be",
|
"Found pcvt driver but X11 seems to be",
|
||||||
" not supported.", CHECK_DRIVER_MSG);
|
" not supported.", CHECK_DRIVER_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
xf86Info.vtno = VTnum;
|
|
||||||
|
|
||||||
if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
|
|
||||||
initialVT = -1;
|
|
||||||
|
|
||||||
if (xf86Info.vtno == -1) {
|
xf86Info.vtno = VTnum;
|
||||||
if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) {
|
|
||||||
/* No free VTs */
|
if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
|
||||||
xf86Info.vtno = -1;
|
initialVT = -1;
|
||||||
}
|
|
||||||
|
if (xf86Info.vtno == -1) {
|
||||||
if (xf86Info.vtno == -1) {
|
if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) {
|
||||||
/*
|
/* No free VTs */
|
||||||
* All VTs are in use. If initialVT was found, use it.
|
xf86Info.vtno = -1;
|
||||||
*/
|
}
|
||||||
if (initialVT != -1) {
|
|
||||||
xf86Info.vtno = initialVT;
|
if (xf86Info.vtno == -1) {
|
||||||
}
|
/*
|
||||||
|
* All VTs are in use. If initialVT was found, use it.
|
||||||
|
*/
|
||||||
|
if (initialVT != -1) {
|
||||||
|
xf86Info.vtno = initialVT;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
FatalError("%s: Cannot find a free VT",
|
FatalError("%s: Cannot find a free VT",
|
||||||
"xf86OpenPcvt");
|
"xf86OpenPcvt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1);
|
snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1);
|
||||||
if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
|
if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
|
||||||
ErrorF("xf86OpenPcvt: Cannot open %s (%s)",
|
ErrorF("xf86OpenPcvt: Cannot open %s (%s)",
|
||||||
vtname, strerror(errno));
|
vtname, strerror(errno));
|
||||||
xf86Info.vtno = initialVT;
|
xf86Info.vtno = initialVT;
|
||||||
snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1);
|
snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno - 1);
|
||||||
if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
|
if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
|
||||||
FatalError("xf86OpenPcvt: Cannot open %s (%s)",
|
FatalError("xf86OpenPcvt: Cannot open %s (%s)",
|
||||||
vtname, strerror(errno));
|
vtname, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ioctl(fd, VT_GETMODE, &vtmode) < 0) {
|
if (ioctl(fd, VT_GETMODE, &vtmode) < 0) {
|
||||||
FatalError("xf86OpenPcvt: VT_GETMODE failed");
|
FatalError("xf86OpenPcvt: VT_GETMODE failed");
|
||||||
}
|
}
|
||||||
xf86Info.consType = PCVT;
|
xf86Info.consType = PCVT;
|
||||||
#ifdef WSCONS_SUPPORT
|
#ifdef WSCONS_SUPPORT
|
||||||
xf86Msg(X_PROBED,
|
xf86Msg(X_PROBED,
|
||||||
"Using wscons driver on %s in pcvt compatibility mode "
|
"Using wscons driver on %s in pcvt compatibility mode "
|
||||||
@ -789,29 +789,29 @@ xf86UseMsg(void)
|
|||||||
void
|
void
|
||||||
xf86DropPriv(void)
|
xf86DropPriv(void)
|
||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
/* revoke privileges */
|
/* revoke privileges */
|
||||||
if (getuid() == 0) {
|
if (getuid() == 0) {
|
||||||
/* Running as root */
|
/* Running as root */
|
||||||
pw = getpwnam("_x11");
|
pw = getpwnam("_x11");
|
||||||
if (!pw)
|
if (!pw)
|
||||||
return;
|
return;
|
||||||
/* give away lock file to unpriviledged user */
|
/* give away lock file to unpriviledged user */
|
||||||
if (ChownLock(pw->pw_uid, pw->pw_gid) == -1) {
|
if (ChownLock(pw->pw_uid, pw->pw_gid) == -1) {
|
||||||
FatalError("Chown Lock");
|
FatalError("Chown Lock");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start privileged child */
|
/* Start privileged child */
|
||||||
if (priv_init(pw->pw_uid, pw->pw_gid) == -1) {
|
if (priv_init(pw->pw_uid, pw->pw_gid) == -1) {
|
||||||
FatalError("priv_init");
|
FatalError("priv_init");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Normal user */
|
/* Normal user */
|
||||||
if (priv_init(getuid(), getgid()) == -1) {
|
if (priv_init(getuid(), getgid()) == -1) {
|
||||||
FatalError("priv_init");
|
FatalError("priv_init");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user