Remove unneeded whitespace.
* fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be set to ENXIO when opening a fifo write/nonblocking. * environ.cc (ucreqenv): Rename to ucenv. Move code from old ucenv here and conditionalize it on create_upcaseenv. (ucenv): Delete. (environ_init): Fix compiler warning by moving create_upcaseenv test to ucenv. Don't bother checking for child_proc_info when calling ucenv since it is assumed to be NULL at the point where the function is called. * path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing with devices since the device handler passes in a translated MS-DOS path. * sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which causes a compiler error. * fhandler_netdrive.cc: Update copyright.
This commit is contained in:
parent
f43f75a09d
commit
025c1fac6e
|
@ -1,3 +1,27 @@
|
|||
2008-11-26 Christopher Faylor <me+cygwin@cgf.cx>
|
||||
|
||||
Remove unneeded whitespace.
|
||||
|
||||
* fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be
|
||||
set to ENXIO when opening a fifo write/nonblocking.
|
||||
|
||||
* environ.cc (ucreqenv): Rename to ucenv. Move code from old ucenv
|
||||
here and conditionalize it on create_upcaseenv.
|
||||
(ucenv): Delete.
|
||||
(environ_init): Fix compiler warning by moving create_upcaseenv test to
|
||||
ucenv. Don't bother checking for child_proc_info when calling ucenv
|
||||
since it is assumed to be NULL at the point where the function is
|
||||
called.
|
||||
|
||||
* path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing
|
||||
with devices since the device handler passes in a translated MS-DOS
|
||||
path.
|
||||
|
||||
* sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which
|
||||
causes a compiler error.
|
||||
|
||||
* fhandler_netdrive.cc: Update copyright.
|
||||
|
||||
2008-11-26 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* Makefile.in (DLL_OFILES): Add setlsapwd.o.
|
||||
|
|
|
@ -437,23 +437,6 @@ unsetenv (const char *name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Turn environment variable part of a=b string into uppercase. */
|
||||
static __inline__ void
|
||||
ucenv (char *p, char *eq)
|
||||
{
|
||||
/* Amazingly, NT has a case sensitive environment name list,
|
||||
but only sometimes.
|
||||
It's normal to have NT set your "Path" to something.
|
||||
Later, you set "PATH" to something else. This alters "Path".
|
||||
But if you try and do a naive getenv on "PATH" you'll get nothing.
|
||||
|
||||
So we upper case the labels here to prevent confusion later but
|
||||
we only do it for the first process in a session group. */
|
||||
for (; p < eq; p++)
|
||||
if (islower (*p))
|
||||
*p = cyg_toupper (*p);
|
||||
}
|
||||
|
||||
/* Minimal list of Windows vars which must be converted to uppercase.
|
||||
Either for POSIX compatibility of for backward compatibility with
|
||||
existing applications. */
|
||||
|
@ -492,11 +475,29 @@ static const char idx_arr[] = "ACHNOPSTW";
|
|||
starts. */
|
||||
static const int start_at[] = { 0, 1, 4, 7, 8, 9, 16, 18, 22 };
|
||||
|
||||
/* Hopefully as quick as possible. Only upcase specific set of important
|
||||
Windows variables. */
|
||||
/* Turn environment variable part of a=b string into uppercase.
|
||||
Conditionally controlled by upcaseenv CYGWIN setting. */
|
||||
static __inline__ void
|
||||
ucreqenv (char *p)
|
||||
ucenv (char *p, const char *eq)
|
||||
{
|
||||
if (create_upcaseenv)
|
||||
{
|
||||
/* Amazingly, NT has a case sensitive environment name list,
|
||||
but only sometimes.
|
||||
It's normal to have NT set your "Path" to something.
|
||||
Later, you set "PATH" to something else. This alters "Path".
|
||||
But if you try and do a naive getenv on "PATH" you'll get nothing.
|
||||
|
||||
So we upper case the labels here to prevent confusion later but
|
||||
we only do it for processes that are started by non-Cygwin programs. */
|
||||
for (; p < eq; p++)
|
||||
if (islower (*p))
|
||||
*p = cyg_toupper (*p);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Hopefully as quickly as possible - only upcase specific set of important
|
||||
Windows variables. */
|
||||
char first = cyg_toupper (*p);
|
||||
const char *idx = strchr (idx_arr, first);
|
||||
if (idx)
|
||||
|
@ -508,6 +509,7 @@ ucreqenv (char *p)
|
|||
strncpy (p, renv_arr[i].name, renv_arr[i].namelen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse CYGWIN options */
|
||||
|
@ -847,14 +849,10 @@ environ_init (char **envp, int envc)
|
|||
if (*newp == '=')
|
||||
*newp = '!';
|
||||
char *eq = strechr (newp, '=');
|
||||
if (!child_proc_info)
|
||||
if (create_upcaseenv)
|
||||
ucenv (newp, eq); /* Uppercase all env vars. */
|
||||
else
|
||||
ucreqenv (newp); /* Uppercase only selected vars. */
|
||||
ucenv (newp, eq); /* (possibly conditionally) uppercase env vars. */
|
||||
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
|
||||
sawTERM = 1;
|
||||
if (*eq && conv_start_chars[(unsigned char)envp[i][0]])
|
||||
if (*eq && conv_start_chars[(unsigned char) envp[i][0]])
|
||||
posify (envp + i, *++eq ? eq : --eq, tmpbuf);
|
||||
debug_printf ("%p: %s", envp[i], envp[i]);
|
||||
}
|
||||
|
|
|
@ -86,13 +86,26 @@ fhandler_fifo::open (int flags, mode_t)
|
|||
LPSECURITY_ATTRIBUTES sa_buf =
|
||||
sec_user ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
|
||||
mode |= FILE_FLAG_OVERLAPPED;
|
||||
HANDLE h = CreateNamedPipe(npname, mode, FIFO_PIPE_MODE,
|
||||
|
||||
HANDLE h;
|
||||
DWORD err;
|
||||
bool nonblocking_write = !!((flags & (O_WRONLY | O_NONBLOCK)) == (O_WRONLY | O_NONBLOCK));
|
||||
if (nonblocking_write)
|
||||
{
|
||||
h = INVALID_HANDLE_VALUE;
|
||||
err = ERROR_ACCESS_DENIED;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = CreateNamedPipe(npname, mode, FIFO_PIPE_MODE,
|
||||
PIPE_UNLIMITED_INSTANCES, 0, 0,
|
||||
NMPWAIT_WAIT_FOREVER, sa_buf);
|
||||
err = GetLastError ();
|
||||
}
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
wait_state = fifo_wait_for_client;
|
||||
else
|
||||
switch (GetLastError ())
|
||||
switch (err)
|
||||
{
|
||||
case ERROR_ACCESS_DENIED:
|
||||
h = open_nonserver (npname, low_flags, sa_buf);
|
||||
|
@ -101,6 +114,11 @@ fhandler_fifo::open (int flags, mode_t)
|
|||
wait_state = fifo_wait_for_server;
|
||||
break;
|
||||
}
|
||||
if (nonblocking_write && GetLastError () == ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
set_errno (ENXIO);
|
||||
break;
|
||||
}
|
||||
/* fall through intentionally */
|
||||
default:
|
||||
__seterrno ();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* fhandler_netdrive.cc: fhandler for // and //MACHINE handling
|
||||
|
||||
Copyright 2005 Red Hat, Inc.
|
||||
Copyright 2005, 2006, 2007, 2008 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* path.cc: path support.
|
||||
/* path.cc: path support.
|
||||
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2006, 2007, 2008 Red Hat, Inc.
|
||||
|
@ -1525,6 +1525,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
|||
NTSTATUS status;
|
||||
HANDLE fh;
|
||||
tmp_pathbuf tp;
|
||||
unsigned check_opt;
|
||||
|
||||
/* POSIX says that empty 'newpath' is invalid input while empty
|
||||
'oldpath' is valid -- it's symlink resolver job to verify if
|
||||
|
@ -1551,14 +1552,16 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
|||
set_errno (ENOENT);
|
||||
goto done;
|
||||
}
|
||||
|
||||
check_opt = PC_SYM_NOFOLLOW | PC_POSIX | (isdevice ? PC_NOWARN : 0);
|
||||
/* We need the normalized full path below. */
|
||||
win32_newpath.check (newpath, PC_SYM_NOFOLLOW | PC_POSIX, stat_suffixes);
|
||||
win32_newpath.check (newpath, check_opt, stat_suffixes);
|
||||
if (use_winsym && !win32_newpath.exists ()
|
||||
&& (isdevice || !win32_newpath.fs_is_nfs ()))
|
||||
{
|
||||
char *newplnk = tp.c_get ();
|
||||
stpcpy (stpcpy (newplnk, newpath), ".lnk");
|
||||
win32_newpath.check (newplnk, PC_SYM_NOFOLLOW | PC_POSIX);
|
||||
win32_newpath.check (newplnk, check_opt);
|
||||
}
|
||||
|
||||
if (win32_newpath.error)
|
||||
|
@ -1621,7 +1624,11 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
|||
/* The symlink target is relative to the directory in which
|
||||
the symlink gets created, not relative to the cwd. Therefore
|
||||
we have to mangle the path quite a bit before calling path_conv. */
|
||||
if (!isabspath (oldpath))
|
||||
if (isabspath (oldpath))
|
||||
win32_oldpath.check (oldpath,
|
||||
PC_SYM_NOFOLLOW,
|
||||
stat_suffixes);
|
||||
else
|
||||
{
|
||||
len = strrchr (win32_newpath.normalized_path, '/')
|
||||
- win32_newpath.normalized_path + 1;
|
||||
|
@ -1630,8 +1637,6 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
|||
oldpath);
|
||||
win32_oldpath.check (absoldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||
}
|
||||
else
|
||||
win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||
if (SUCCEEDED (SHGetDesktopFolder (&psl)))
|
||||
{
|
||||
WCHAR wc_path[win32_oldpath.get_wide_win32_path_len () + 1];
|
||||
|
|
|
@ -1221,7 +1221,8 @@ lsaprivkeyauth (struct passwd *pw)
|
|||
}
|
||||
|
||||
/* The key is not 0-terminated. */
|
||||
PWCHAR passwd = (PWCHAR) alloca (data->Length + sizeof (WCHAR));
|
||||
PWCHAR passwd;
|
||||
passwd = (PWCHAR) alloca (data->Length + sizeof (WCHAR));
|
||||
*wcpncpy (passwd, data->Buffer, data->Length / sizeof (WCHAR)) = L'\0';
|
||||
LsaFreeMemory (data);
|
||||
debug_printf ("Try logon for %W\\%W", domain, user);
|
||||
|
|
Loading…
Reference in New Issue