mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-18 19:52:21 +00:00
Merge latest changes from CYGWIN branch
Use find | xargs combination instead of simple shell globbing to prevent
commandline argument overflow
This commit is contained in:
parent
a12a678bc9
commit
8ef3e7052e
6 changed files with 128 additions and 5 deletions
|
|
@ -35,6 +35,7 @@ from The Open Group.
|
|||
#endif
|
||||
#include "winprefs.h"
|
||||
#include "X11/Xlocale.h"
|
||||
#include <mntent.h>
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -45,7 +46,7 @@ extern int g_iNumScreens;
|
|||
extern winScreenInfo g_ScreenInfo[];
|
||||
extern int g_iLastScreen;
|
||||
extern char * g_pszCommandLine;
|
||||
extern Bool g_fUseMsg;
|
||||
extern Bool g_fSilentFatalError;
|
||||
|
||||
extern char * g_pszLogFile;
|
||||
extern int g_iLogVerbose;
|
||||
|
|
@ -72,6 +73,7 @@ extern FARPROC g_fpDirectDrawCreateClipper;
|
|||
extern HMODULE g_hmodCommonControls;
|
||||
extern FARPROC g_fpTrackMouseEvent;
|
||||
extern Bool g_fNoHelpMessageBox;
|
||||
extern Bool g_fSilentDupError;
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -267,6 +269,89 @@ AbortDDX (void)
|
|||
ddxGiveUp ();
|
||||
}
|
||||
|
||||
/* hasmntopt is currently not implemented for cygwin */
|
||||
const char *winCheckMntOpt(const struct mntent *mnt, const char *opt)
|
||||
{
|
||||
const char *s;
|
||||
size_t len;
|
||||
if (mnt == NULL)
|
||||
return NULL;
|
||||
if (opt == NULL)
|
||||
return NULL;
|
||||
if (mnt->mnt_opts == NULL)
|
||||
return NULL;
|
||||
|
||||
len = strlen(opt);
|
||||
s = strstr(mnt->mnt_opts, opt);
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
if ((s == mnt->mnt_opts || *(s-1) == ',') && (s[len] == 0 || s[len] == ','))
|
||||
return (char *)opt;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
winCheckMount(void)
|
||||
{
|
||||
FILE *mnt;
|
||||
struct mntent *ent;
|
||||
|
||||
enum { none = 0, sys_root, user_root, sys_tmp, user_tmp }
|
||||
level = none, curlevel;
|
||||
BOOL binary = TRUE;
|
||||
|
||||
mnt = setmntent("/etc/mtab", "r");
|
||||
if (mnt == NULL)
|
||||
{
|
||||
ErrorF("setmntent failed");
|
||||
return;
|
||||
}
|
||||
|
||||
while ((ent = getmntent(mnt)) != NULL)
|
||||
{
|
||||
BOOL system = (strcmp(ent->mnt_type, "system") == 0);
|
||||
BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
|
||||
BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
|
||||
|
||||
if (system)
|
||||
{
|
||||
if (root)
|
||||
curlevel = sys_root;
|
||||
else if (tmp)
|
||||
curlevel = sys_tmp;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (root)
|
||||
curlevel = user_root;
|
||||
else if (tmp)
|
||||
curlevel = user_tmp;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
if (curlevel <= level)
|
||||
continue;
|
||||
level = curlevel;
|
||||
|
||||
if (winCheckMntOpt(ent, "binmode") == NULL)
|
||||
binary = 0;
|
||||
else
|
||||
binary = 1;
|
||||
}
|
||||
|
||||
if (endmntent(mnt) != 1)
|
||||
{
|
||||
ErrorF("endmntent failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!binary)
|
||||
winMsg(X_WARNING, "/tmp mounted int textmode\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OsVendorInit (void)
|
||||
|
|
@ -296,6 +381,8 @@ OsVendorInit (void)
|
|||
if (serverGeneration == 1)
|
||||
winLogVersionInfo ();
|
||||
|
||||
winCheckMount();
|
||||
|
||||
/* Add a default screen if no screens were specified */
|
||||
if (g_iNumScreens == 0)
|
||||
{
|
||||
|
|
@ -472,7 +559,7 @@ void
|
|||
ddxUseMsg(void)
|
||||
{
|
||||
/* Set a flag so that FatalError won't give duplicate warning message */
|
||||
g_fUseMsg = TRUE;
|
||||
g_fSilentFatalError = TRUE;
|
||||
|
||||
winUseMsg();
|
||||
|
||||
|
|
@ -534,6 +621,8 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
|
|||
/* Check for duplicate invocation on same display number.*/
|
||||
if (serverGeneration == 1 && !winCheckDisplayNumber ())
|
||||
{
|
||||
if (g_fSilentDupError)
|
||||
g_fSilentFatalError = TRUE;
|
||||
FatalError ("InitOutput - Duplicate invocation on display "
|
||||
"number: %s. Exiting.\n", display);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue