mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-01 03:50:28 +08:00
Throughout, change 'cygwin_shared.mount' to 'mount_table'.
* child_info.h (child_info): Move shared_h, console_h to cygheap. Add mount_h. * cygheap.h (init_cygheap): Add shared_h, console_h. * cygheap.cc (init_cheap): Initialize heap at a fixed location after the shared memory regions. Initialize cygheap->user name here. * dcrt0.cc (dll_crt0_1): Call getpagesize () to initialize constants. Remove cygheap_init since it is done in shared_init now. (_dll_crt0): Initialize mount_h, remove shared_h and console_h initialization. * fhandler_console.cc (console_shared_h): Eliminate. (get_tty_stuff): Use cygheap->console_h rather than console_shared_h. * heap.cc (heap_init): Use page size constant calculated earlier in initialization. * shared.cc: Eliminate cygwin_shared_h. Add cygwin_mount_h. (mount_table_init): New function for initializing a user mount table. (open_shared_file_map): Use constant for shared memory region. Initialize cygheap and mount table here. (open_shared): Improve debugging output. (shared_info::initialize): Eliminate call to mount.init. (shared_terminate): Use cygheap->shared_h. Close cygwin_mount_h. (open_shared_file_map): Eliminate. * shared_info.h (mount_info): Add a version field. (shared_align_past): New macro for calculating location for shared memory regions. * sigproc.cc (init_child_info): Eliminate shared_h, console_h. * spawn.cc (spawn_guts): Pass on cygwin_mount_h iff not a different user. * syscalls.cc (system_info): New global holding system memory defaults. (getpagesize): Use system_info. * uinfo.cc (internal_getlogin): Only fill in user name if nonexistent. * winsup.h: Declare system_info. * passwd.cc (read_etc_passwd): Use cygheap->user.name () rather than retrieving the name again.
This commit is contained in:
parent
022ce214de
commit
2a6fc028ba
@ -1,3 +1,36 @@
|
||||
Sun Jan 28 00:28:30 2001 Christopher Faylor <cgf@cygnus.com>
|
||||
|
||||
Throughout, change 'cygwin_shared.mount' to 'mount_table'.
|
||||
* child_info.h (child_info): Move shared_h, console_h to cygheap. Add
|
||||
mount_h.
|
||||
* cygheap.h (init_cygheap): Add shared_h, console_h.
|
||||
* cygheap.cc (init_cheap): Initialize heap at a fixed location after
|
||||
the shared memory regions. Initialize cygheap->user name here.
|
||||
* dcrt0.cc (dll_crt0_1): Call getpagesize () to initialize constants.
|
||||
Remove cygheap_init since it is done in shared_init now.
|
||||
(_dll_crt0): Initialize mount_h, remove shared_h and console_h
|
||||
initialization.
|
||||
* fhandler_console.cc (console_shared_h): Eliminate.
|
||||
(get_tty_stuff): Use cygheap->console_h rather than console_shared_h.
|
||||
* heap.cc (heap_init): Use page size constant calculated earlier in initialization.
|
||||
* shared.cc: Eliminate cygwin_shared_h. Add cygwin_mount_h.
|
||||
(mount_table_init): New function for initializing a user mount table.
|
||||
(open_shared_file_map): Use constant for shared memory region. Initialize cygheap and mount table here.
|
||||
(open_shared): Improve debugging output.
|
||||
(shared_info::initialize): Eliminate call to mount.init.
|
||||
(shared_terminate): Use cygheap->shared_h. Close cygwin_mount_h.
|
||||
(open_shared_file_map): Eliminate.
|
||||
* shared_info.h (mount_info): Add a version field.
|
||||
(shared_align_past): New macro for calculating location for shared memory regions.
|
||||
* sigproc.cc (init_child_info): Eliminate shared_h, console_h.
|
||||
* spawn.cc (spawn_guts): Pass on cygwin_mount_h iff not a different user.
|
||||
* syscalls.cc (system_info): New global holding system memory defaults.
|
||||
(getpagesize): Use system_info.
|
||||
* uinfo.cc (internal_getlogin): Only fill in user name if nonexistent.
|
||||
* winsup.h: Declare system_info.
|
||||
|
||||
* passwd.cc (read_etc_passwd): Use cygheap->user.name () rather than retrieving the name again.
|
||||
|
||||
Sat Jan 27 10:18:02 2001 Christopher Faylor <cgf@cygnus.com>
|
||||
|
||||
* path.cc (path_conv::check): Detect when path has symlinks.
|
||||
|
@ -12,7 +12,7 @@ details. */
|
||||
|
||||
enum
|
||||
{
|
||||
PROC_MAGIC = 0xaf0bf000,
|
||||
PROC_MAGIC = 0xaf0cf000,
|
||||
PROC_FORK = PROC_MAGIC + 1,
|
||||
PROC_EXEC = PROC_MAGIC + 2,
|
||||
PROC_SPAWN = PROC_MAGIC + 3,
|
||||
@ -34,8 +34,7 @@ public:
|
||||
DWORD type; // type of record
|
||||
int cygpid; // cygwin pid of child process
|
||||
HANDLE subproc_ready; // used for synchronization with parent
|
||||
HANDLE shared_h;
|
||||
HANDLE console_h;
|
||||
HANDLE mount_h;
|
||||
HANDLE parent;
|
||||
HANDLE pppid_handle;
|
||||
init_cygheap *cygheap;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "heap.h"
|
||||
#include "cygerrno.h"
|
||||
#include "sync.h"
|
||||
#include "shared_info.h"
|
||||
|
||||
init_cygheap NO_COPY *cygheap;
|
||||
void NO_COPY *cygheap_max = NULL;
|
||||
@ -26,10 +27,19 @@ static NO_COPY muto *cygheap_protect = NULL;
|
||||
inline static void
|
||||
init_cheap ()
|
||||
{
|
||||
cygheap = (init_cygheap *) VirtualAlloc (NULL, CYGHEAPSIZE, MEM_RESERVE, PAGE_NOACCESS);
|
||||
void *addr = cygheap_address;
|
||||
cygheap = (init_cygheap *) VirtualAlloc (addr, CYGHEAPSIZE, MEM_RESERVE, PAGE_NOACCESS);
|
||||
if (!cygheap)
|
||||
api_fatal ("Couldn't reserve space for cygwin's heap, %E");
|
||||
cygheap_max = cygheap + 1;
|
||||
|
||||
char username[MAX_USER_NAME];
|
||||
DWORD username_len = MAX_USER_NAME;
|
||||
|
||||
if (!GetUserName (username, &username_len))
|
||||
cygheap->user.set_name ("unknown");
|
||||
else
|
||||
cygheap->user.set_name (username);
|
||||
}
|
||||
|
||||
#define pagetrunc(x) ((void *) (((DWORD) (x)) & ~(4096 - 1)))
|
||||
|
@ -103,6 +103,8 @@ struct init_cygheap
|
||||
cygheap_root root;
|
||||
cygheap_user user;
|
||||
mode_t umask;
|
||||
HANDLE shared_h;
|
||||
HANDLE console_h;
|
||||
};
|
||||
|
||||
extern init_cygheap *cygheap;
|
||||
|
@ -632,9 +632,7 @@ dll_crt0_1 ()
|
||||
/* FIXME: Verify forked children get their exception handler set up ok. */
|
||||
exception_list cygwin_except_entry;
|
||||
|
||||
/* Initialize SIGSEGV handling, etc... Because the exception handler
|
||||
references data in the shared area, this must be done after
|
||||
shared_init. */
|
||||
/* Initialize SIGSEGV handling, etc. */
|
||||
init_exceptions (&cygwin_except_entry);
|
||||
|
||||
do_global_ctors (&__CTOR_LIST__, 1);
|
||||
@ -656,6 +654,7 @@ dll_crt0_1 ()
|
||||
|
||||
threadname_init ();
|
||||
debug_init ();
|
||||
(void) getpagesize (); /* initialize page size constant */
|
||||
|
||||
regthread ("main", GetCurrentThreadId ());
|
||||
mainthread.init ("mainthread"); // For use in determining if signals
|
||||
@ -735,9 +734,6 @@ dll_crt0_1 ()
|
||||
/* Initialize events. */
|
||||
events_init ();
|
||||
|
||||
if (!child_proc_info)
|
||||
cygheap_init ();
|
||||
|
||||
cygcwd.init ();
|
||||
|
||||
cygbench ("pre-forkee");
|
||||
@ -918,9 +914,8 @@ _dll_crt0 ()
|
||||
case PROC_EXEC:
|
||||
{
|
||||
child_proc_info = fork_info;
|
||||
cygwin_mount_h = child_proc_info->mount_h;
|
||||
mypid = child_proc_info->cygpid;
|
||||
cygwin_shared_h = child_proc_info->shared_h;
|
||||
console_shared_h = child_proc_info->console_h;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -299,7 +299,7 @@ static int NO_COPY keep_looping = 0;
|
||||
extern "C" int
|
||||
try_to_debug ()
|
||||
{
|
||||
debug_printf ("debugger_command %s", debugger_command);
|
||||
debug_printf ("debugger_command '%s'", debugger_command);
|
||||
if (*debugger_command == '\0')
|
||||
return 0;
|
||||
|
||||
@ -358,7 +358,7 @@ try_to_debug ()
|
||||
}
|
||||
else
|
||||
{
|
||||
char event_name [ sizeof ("cygwin_error_start_event") + 9 ];
|
||||
char event_name [sizeof ("cygwin_error_start_event") + 9];
|
||||
DWORD win32_pid = GetCurrentProcessId ();
|
||||
__small_sprintf (event_name, "cygwin_error_start_event%x", win32_pid);
|
||||
HANDLE sync_with_dbg = CreateEvent (NULL, TRUE, FALSE, event_name);
|
||||
|
@ -91,9 +91,8 @@ static DWORD
|
||||
get_cygdrive_info (char *user, char *system, char *user_flags,
|
||||
char *system_flags)
|
||||
{
|
||||
shared_info *info = cygwin_getshared();
|
||||
int res = info->mount.get_cygdrive_info (user, system, user_flags,
|
||||
system_flags);
|
||||
int res = mount_table->get_cygdrive_info (user, system, user_flags,
|
||||
system_flags);
|
||||
return (res == ERROR_SUCCESS) ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -138,7 +137,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
||||
|
||||
case CW_READ_V1_MOUNT_TABLES:
|
||||
/* Upgrade old v1 registry mounts to new location. */
|
||||
cygwin_shared->mount.import_v1_mounts ();
|
||||
mount_table->import_v1_mounts ();
|
||||
return 0;
|
||||
|
||||
case CW_USER_DATA:
|
||||
|
@ -20,6 +20,7 @@ details. */
|
||||
#include <wincon.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/cygwin.h>
|
||||
#include "cygheap.h"
|
||||
#include "cygerrno.h"
|
||||
#include "fhandler.h"
|
||||
#include "sync.h"
|
||||
@ -49,8 +50,6 @@ const char * get_nonascii_key (INPUT_RECORD&, char *);
|
||||
|
||||
static BOOL use_mouse = FALSE;
|
||||
|
||||
HANDLE console_shared_h;
|
||||
|
||||
static tty_min NO_COPY *shared_console_info = NULL;
|
||||
|
||||
/* Allocate and initialize the shared record for the current console.
|
||||
@ -61,10 +60,10 @@ get_tty_stuff (int force = 0)
|
||||
if (shared_console_info && !force)
|
||||
return shared_console_info;
|
||||
|
||||
shared_console_info = (tty_min *) open_shared (NULL, console_shared_h,
|
||||
shared_console_info = (tty_min *) open_shared (NULL, cygheap->console_h,
|
||||
sizeof (*shared_console_info),
|
||||
NULL);
|
||||
ProtectHandle (console_shared_h);
|
||||
ProtectHandle (cygheap->console_h);
|
||||
shared_console_info->setntty (TTY_CONSOLE);
|
||||
shared_console_info->setsid (myself->sid);
|
||||
return shared_console_info;
|
||||
|
@ -130,8 +130,8 @@ void
|
||||
read_etc_group ()
|
||||
{
|
||||
extern int group_sem;
|
||||
char linebuf [ 200 ];
|
||||
char group_name [ MAX_USER_NAME ];
|
||||
char linebuf [200];
|
||||
char group_name [MAX_USER_NAME];
|
||||
DWORD group_name_len = MAX_USER_NAME;
|
||||
|
||||
strncpy (group_name, "Administrators", sizeof (group_name));
|
||||
@ -152,7 +152,7 @@ read_etc_group ()
|
||||
}
|
||||
else /* /etc/group doesn't exist -- create default one in memory */
|
||||
{
|
||||
char domain_name [ MAX_DOMAIN_NAME ];
|
||||
char domain_name [MAX_DOMAIN_NAME];
|
||||
DWORD domain_name_len = MAX_DOMAIN_NAME;
|
||||
SID_NAME_USE acType;
|
||||
debug_printf ("Emulating /etc/group");
|
||||
|
@ -31,7 +31,7 @@ heap_init ()
|
||||
/* If we're the forkee, we must allocate the heap at exactly the same place
|
||||
as our parent. If not, we don't care where it ends up. */
|
||||
|
||||
page_const = getpagesize ();
|
||||
page_const = system_info.dwPageSize;
|
||||
if (brkbase)
|
||||
{
|
||||
DWORD chunk = brkchunk; /* allocation chunk */
|
||||
|
@ -42,7 +42,7 @@ static pwd_state passwd_state = uninitialized;
|
||||
|
||||
/* Position in the passwd cache */
|
||||
#ifdef _MT_SAFE
|
||||
#define pw_pos _reent_winsup()->_pw_pos
|
||||
#define pw_pos _reent_winsup ()->_pw_pos
|
||||
#else
|
||||
static int pw_pos = 0;
|
||||
#endif
|
||||
@ -92,7 +92,7 @@ parse_pwd (struct passwd &res, char *buf)
|
||||
if (mybuf[--len] == '\n')
|
||||
mybuf[len] = '\0';
|
||||
|
||||
res.pw_name = strlwr(grab_string (&mybuf));
|
||||
res.pw_name = strlwr (grab_string (&mybuf));
|
||||
res.pw_passwd = grab_string (&mybuf);
|
||||
res.pw_uid = grab_int (&mybuf);
|
||||
res.pw_gid = grab_int (&mybuf);
|
||||
@ -140,14 +140,7 @@ read_etc_passwd ()
|
||||
else
|
||||
{
|
||||
debug_printf ("Emulating /etc/passwd");
|
||||
char user_name [ MAX_USER_NAME ];
|
||||
DWORD user_name_len = MAX_USER_NAME;
|
||||
if (! GetUserNameA (user_name, &user_name_len))
|
||||
{
|
||||
strncpy (user_name, "Administrator", MAX_USER_NAME);
|
||||
debug_printf ("Failed to get current user name. %E");
|
||||
}
|
||||
snprintf (linebuf, sizeof (linebuf), "%s::%u:%u::%s:/bin/sh", user_name,
|
||||
snprintf (linebuf, sizeof (linebuf), "%s::%u:%u::%s:/bin/sh", cygheap->user.name (),
|
||||
DEFAULT_UID, DEFAULT_GID, getenv ("HOME") ?: "/");
|
||||
add_pwd_line (linebuf);
|
||||
passwd_state = emulated;
|
||||
@ -180,7 +173,7 @@ search_for (uid_t uid, const char *name)
|
||||
request for the current user. */
|
||||
if (passwd_state != loaded
|
||||
|| (!name && uid == myself->uid)
|
||||
|| (name && strcasematch(name, cygheap->user.name ())))
|
||||
|| (name && strcasematch (name, cygheap->user.name ())))
|
||||
return default_pw;
|
||||
|
||||
return NULL;
|
||||
@ -190,7 +183,7 @@ extern "C" struct passwd *
|
||||
getpwuid (uid_t uid)
|
||||
{
|
||||
if (passwd_state == uninitialized)
|
||||
read_etc_passwd();
|
||||
read_etc_passwd ();
|
||||
|
||||
return search_for (uid, 0);
|
||||
}
|
||||
@ -199,7 +192,7 @@ extern "C" struct passwd *
|
||||
getpwnam (const char *name)
|
||||
{
|
||||
if (passwd_state == uninitialized)
|
||||
read_etc_passwd();
|
||||
read_etc_passwd ();
|
||||
|
||||
return search_for (0, name);
|
||||
}
|
||||
@ -208,7 +201,7 @@ extern "C" struct passwd *
|
||||
getpwent (void)
|
||||
{
|
||||
if (passwd_state == uninitialized)
|
||||
read_etc_passwd();
|
||||
read_etc_passwd ();
|
||||
|
||||
if (pw_pos < curr_lines)
|
||||
return passwd_buf + pw_pos++;
|
||||
@ -220,7 +213,7 @@ extern "C" struct passwd *
|
||||
getpwduid (uid_t)
|
||||
{
|
||||
if (passwd_state == uninitialized)
|
||||
read_etc_passwd();
|
||||
read_etc_passwd ();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -229,7 +222,7 @@ extern "C" void
|
||||
setpwent (void)
|
||||
{
|
||||
if (passwd_state == uninitialized)
|
||||
read_etc_passwd();
|
||||
read_etc_passwd ();
|
||||
|
||||
pw_pos = 0;
|
||||
}
|
||||
@ -238,7 +231,7 @@ extern "C" void
|
||||
endpwent (void)
|
||||
{
|
||||
if (passwd_state == uninitialized)
|
||||
read_etc_passwd();
|
||||
read_etc_passwd ();
|
||||
|
||||
pw_pos = 0;
|
||||
}
|
||||
@ -247,7 +240,7 @@ extern "C" int
|
||||
setpassent ()
|
||||
{
|
||||
if (passwd_state == uninitialized)
|
||||
read_etc_passwd();
|
||||
read_etc_passwd ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -256,14 +249,14 @@ extern "C" char *
|
||||
getpass (const char * prompt)
|
||||
{
|
||||
#ifdef _MT_SAFE
|
||||
char *pass=_reent_winsup()->_pass;
|
||||
char *pass=_reent_winsup ()->_pass;
|
||||
#else
|
||||
static char pass[_PASSWORD_LEN];
|
||||
#endif
|
||||
struct termios ti, newti;
|
||||
|
||||
if (passwd_state == uninitialized)
|
||||
read_etc_passwd();
|
||||
read_etc_passwd ();
|
||||
|
||||
if (fdtab.not_open (0))
|
||||
{
|
||||
|
@ -102,12 +102,12 @@ cwdstuff cygcwd; /* The current working directory. */
|
||||
|
||||
/* Determine if path prefix matches current cygdrive */
|
||||
#define iscygdrive(path) \
|
||||
(path_prefix_p (cygwin_shared->mount.cygdrive, (path), cygwin_shared->mount.cygdrive_len))
|
||||
(path_prefix_p (mount_table->cygdrive, (path), mount_table->cygdrive_len))
|
||||
|
||||
#define iscygdrive_device(path) \
|
||||
(iscygdrive(path) && isalpha(path[cygwin_shared->mount.cygdrive_len]) && \
|
||||
(isdirsep(path[cygwin_shared->mount.cygdrive_len + 1]) || \
|
||||
!path[cygwin_shared->mount.cygdrive_len + 1]))
|
||||
(iscygdrive(path) && isalpha(path[mount_table->cygdrive_len]) && \
|
||||
(isdirsep(path[mount_table->cygdrive_len + 1]) || \
|
||||
!path[mount_table->cygdrive_len + 1]))
|
||||
|
||||
#define ischrootpath(p) \
|
||||
(cygheap->root.length () && \
|
||||
@ -214,9 +214,8 @@ path_conv::check (const char *src, unsigned opt,
|
||||
(p[1] == '\0' || strcmp (p, "\\.") == 0))
|
||||
need_directory = 1;
|
||||
/* Must look up path in mount table, etc. */
|
||||
error = cygwin_shared->mount.conv_to_win32_path (src, rel_path,
|
||||
full_path,
|
||||
devn, unit, &path_flags);
|
||||
error = mount_table->conv_to_win32_path (src, rel_path, full_path, devn,
|
||||
unit, &path_flags);
|
||||
MALLOC_CHECK;
|
||||
if (error)
|
||||
return;
|
||||
@ -360,7 +359,7 @@ path_conv::check (const char *src, unsigned opt,
|
||||
p = sym.contents - headlen;
|
||||
memcpy (p, path_copy, headlen);
|
||||
MALLOC_CHECK;
|
||||
error = cygwin_shared->mount.conv_to_posix_path (p, tmp_buf, 1);
|
||||
error = mount_table->conv_to_posix_path (p, tmp_buf, 1);
|
||||
MALLOC_CHECK;
|
||||
if (error)
|
||||
return;
|
||||
@ -949,8 +948,6 @@ conv_path_list (const char *src, char *dst, int to_posix_p)
|
||||
while (s != NULL);
|
||||
}
|
||||
|
||||
/************************* mount_info class ****************************/
|
||||
|
||||
/* init: Initialize the mount table. */
|
||||
|
||||
void
|
||||
@ -1035,7 +1032,7 @@ mount_info::conv_to_win32_path (const char *src_path, char *win32_path,
|
||||
{
|
||||
char posix_path[MAX_PATH + 1];
|
||||
|
||||
rc = cygwin_shared->mount.conv_to_posix_path (dst, posix_path, 0);
|
||||
rc = mount_table->conv_to_posix_path (dst, posix_path, 0);
|
||||
if (rc)
|
||||
{
|
||||
debug_printf ("conv_to_posix_path failed, rc %d", rc);
|
||||
@ -1397,7 +1394,7 @@ mount_info::read_mounts (reg_key& r)
|
||||
mount_flags = subkey.get_int ("flags", 0);
|
||||
|
||||
/* Add mount_item corresponding to registry mount point. */
|
||||
res = cygwin_shared->mount.add_item (native_path, posix_path, mount_flags, FALSE);
|
||||
res = mount_table->add_item (native_path, posix_path, mount_flags, FALSE);
|
||||
if (res && get_errno () == EMFILE)
|
||||
break; /* The number of entries exceeds MAX_MOUNTS */
|
||||
}
|
||||
@ -1625,11 +1622,11 @@ mount_info::write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsign
|
||||
1. setting user path prefix, or
|
||||
2. overwriting (a previous) system path prefix */
|
||||
if ((flags & MOUNT_SYSTEM) == 0 ||
|
||||
(cygwin_shared->mount.cygdrive_flags & MOUNT_SYSTEM) != 0)
|
||||
(mount_table->cygdrive_flags & MOUNT_SYSTEM) != 0)
|
||||
{
|
||||
slashify (cygdrive_prefix, cygwin_shared->mount.cygdrive, 1);
|
||||
cygwin_shared->mount.cygdrive_flags = flags;
|
||||
cygwin_shared->mount.cygdrive_len = strlen(cygwin_shared->mount.cygdrive);
|
||||
slashify (cygdrive_prefix, mount_table->cygdrive, 1);
|
||||
mount_table->cygdrive_flags = flags;
|
||||
mount_table->cygdrive_len = strlen(mount_table->cygdrive);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1962,7 +1959,7 @@ mount_info::read_v1_mounts (reg_key r, unsigned which)
|
||||
we're reading. */
|
||||
mountflags |= which;
|
||||
|
||||
int res = cygwin_shared->mount.add_item (win32path, unixpath, mountflags, TRUE);
|
||||
int res = mount_table->add_item (win32path, unixpath, mountflags, TRUE);
|
||||
if (res && get_errno () == EMFILE)
|
||||
break; /* The number of entries exceeds MAX_MOUNTS */
|
||||
}
|
||||
@ -2010,42 +2007,42 @@ mount_item::getmntent ()
|
||||
static NO_COPY struct mntent ret;
|
||||
#endif
|
||||
|
||||
/* Pass back pointers to mount_info strings reserved for use by
|
||||
/* Pass back pointers to mount_table strings reserved for use by
|
||||
getmntent rather than pointers to strings in the internal mount
|
||||
table because the mount table might change, causing weird effects
|
||||
from the getmntent user's point of view. */
|
||||
|
||||
strcpy (cygwin_shared->mount.mnt_fsname, native_path);
|
||||
ret.mnt_fsname = cygwin_shared->mount.mnt_fsname;
|
||||
strcpy (cygwin_shared->mount.mnt_dir, posix_path);
|
||||
ret.mnt_dir = cygwin_shared->mount.mnt_dir;
|
||||
strcpy (mount_table->mnt_fsname, native_path);
|
||||
ret.mnt_fsname = mount_table->mnt_fsname;
|
||||
strcpy (mount_table->mnt_dir, posix_path);
|
||||
ret.mnt_dir = mount_table->mnt_dir;
|
||||
|
||||
if (!(flags & MOUNT_SYSTEM)) /* user mount */
|
||||
strcpy (cygwin_shared->mount.mnt_type, (char *) "user");
|
||||
strcpy (mount_table->mnt_type, (char *) "user");
|
||||
else /* system mount */
|
||||
strcpy (cygwin_shared->mount.mnt_type, (char *) "system");
|
||||
strcpy (mount_table->mnt_type, (char *) "system");
|
||||
|
||||
if ((flags & MOUNT_AUTO)) /* cygdrive */
|
||||
strcat (cygwin_shared->mount.mnt_type, (char *) ",auto");
|
||||
strcat (mount_table->mnt_type, (char *) ",auto");
|
||||
|
||||
ret.mnt_type = cygwin_shared->mount.mnt_type;
|
||||
ret.mnt_type = mount_table->mnt_type;
|
||||
|
||||
/* mnt_opts is a string that details mount params such as
|
||||
binary or textmode, or exec. We don't print
|
||||
`silent' here; it's a magic internal thing. */
|
||||
|
||||
if (! (flags & MOUNT_BINARY))
|
||||
strcpy (cygwin_shared->mount.mnt_opts, (char *) "textmode");
|
||||
strcpy (mount_table->mnt_opts, (char *) "textmode");
|
||||
else
|
||||
strcpy (cygwin_shared->mount.mnt_opts, (char *) "binmode");
|
||||
strcpy (mount_table->mnt_opts, (char *) "binmode");
|
||||
|
||||
if (flags & MOUNT_CYGWIN_EXEC)
|
||||
strcat (cygwin_shared->mount.mnt_opts, (char *) ",cygexec");
|
||||
strcat (mount_table->mnt_opts, (char *) ",cygexec");
|
||||
else if (flags & MOUNT_EXEC)
|
||||
strcat (cygwin_shared->mount.mnt_opts, (char *) ",exec");
|
||||
strcat (mount_table->mnt_opts, (char *) ",exec");
|
||||
|
||||
|
||||
ret.mnt_opts = cygwin_shared->mount.mnt_opts;
|
||||
ret.mnt_opts = mount_table->mnt_opts;
|
||||
|
||||
ret.mnt_freq = 1;
|
||||
ret.mnt_passno = 1;
|
||||
@ -2086,11 +2083,11 @@ mount (const char *win32_path, const char *posix_path, unsigned flags)
|
||||
/* When flags include MOUNT_AUTO, take this to mean that
|
||||
we actually want to change the cygdrive prefix and flags
|
||||
without actually mounting anything. */
|
||||
res = cygwin_shared->mount.write_cygdrive_info_to_registry (posix_path, flags);
|
||||
res = mount_table->write_cygdrive_info_to_registry (posix_path, flags);
|
||||
win32_path = NULL;
|
||||
}
|
||||
else
|
||||
res = cygwin_shared->mount.add_item (win32_path, posix_path, flags, TRUE);
|
||||
res = mount_table->add_item (win32_path, posix_path, flags, TRUE);
|
||||
|
||||
syscall_printf ("%d = mount (%s, %s, %p)", res, win32_path, posix_path, flags);
|
||||
return res;
|
||||
@ -2123,11 +2120,11 @@ cygwin_umount (const char *path, unsigned flags)
|
||||
/* When flags include MOUNT_AUTO, take this to mean that we actually want
|
||||
to remove the cygdrive prefix and flags without actually unmounting
|
||||
anything. */
|
||||
res = cygwin_shared->mount.remove_cygdrive_info_from_registry (path, flags);
|
||||
res = mount_table->remove_cygdrive_info_from_registry (path, flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = cygwin_shared->mount.del_item (path, flags, TRUE);
|
||||
res = mount_table->del_item (path, flags, TRUE);
|
||||
}
|
||||
|
||||
syscall_printf ("%d = cygwin_umount (%s, %d)", res, path, flags);
|
||||
@ -2152,7 +2149,7 @@ extern "C"
|
||||
struct mntent *
|
||||
getmntent (FILE *)
|
||||
{
|
||||
return cygwin_shared->mount.getmntent (iteration++);
|
||||
return mount_table->getmntent (iteration++);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
@ -2643,7 +2640,7 @@ cygwin_conv_to_posix_path (const char *path, char *posix_path)
|
||||
{
|
||||
if (check_null_empty_path_errno (path))
|
||||
return -1;
|
||||
cygwin_shared->mount.conv_to_posix_path (path, posix_path, 1);
|
||||
mount_table->conv_to_posix_path (path, posix_path, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2653,7 +2650,7 @@ cygwin_conv_to_full_posix_path (const char *path, char *posix_path)
|
||||
{
|
||||
if (check_null_empty_path_errno (path))
|
||||
return -1;
|
||||
cygwin_shared->mount.conv_to_posix_path (path, posix_path, 0);
|
||||
mount_table->conv_to_posix_path (path, posix_path, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2671,7 +2668,7 @@ realpath (const char *path, char *resolved)
|
||||
err = real_path.error;
|
||||
else
|
||||
{
|
||||
err = cygwin_shared->mount.conv_to_posix_path (real_path.get_win32 (), resolved, 0);
|
||||
err = mount_table->conv_to_posix_path (real_path.get_win32 (), resolved, 0);
|
||||
if (err == 0)
|
||||
return resolved;
|
||||
}
|
||||
@ -2728,11 +2725,11 @@ conv_path_list_buf_size (const char *path_list, int to_posix_p)
|
||||
++p;
|
||||
|
||||
/* 7: strlen ("//c") + slop, a conservative initial value */
|
||||
for (max_mount_path_len = 7, i = 0; i < cygwin_shared->mount.nmounts; ++i)
|
||||
for (max_mount_path_len = 7, i = 0; i < mount_table->nmounts; ++i)
|
||||
{
|
||||
int mount_len = (to_posix_p
|
||||
? cygwin_shared->mount.mount[i].posix_pathlen
|
||||
: cygwin_shared->mount.mount[i].native_pathlen);
|
||||
? mount_table->mount[i].posix_pathlen
|
||||
: mount_table->mount[i].native_pathlen);
|
||||
if (max_mount_path_len < mount_len)
|
||||
max_mount_path_len = mount_len;
|
||||
}
|
||||
@ -2944,7 +2941,7 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd)
|
||||
}
|
||||
|
||||
if (!posix_cwd)
|
||||
cygwin_shared->mount.conv_to_posix_path (win32, pathbuf, 0);
|
||||
mount_table->conv_to_posix_path (win32, pathbuf, 0);
|
||||
else
|
||||
(void) normalize_posix_path (posix_cwd, pathbuf);
|
||||
|
||||
|
@ -86,7 +86,7 @@ reg_key::build_reg (HKEY top, REGSAM access, va_list av)
|
||||
be created and set had_to_create appropriately. */
|
||||
if (strcmp (name, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME) == 0)
|
||||
if (disp == REG_CREATED_NEW_KEY)
|
||||
cygwin_shared->mount.had_to_create_mount_areas++;
|
||||
mount_table->had_to_create_mount_areas++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ get_sid (PSID psid, DWORD s, DWORD cnt, DWORD *r)
|
||||
{
|
||||
DWORD i;
|
||||
|
||||
if (! psid || s > 5 || cnt < 1 || cnt > 8)
|
||||
if (!psid || s > 5 || cnt < 1 || cnt > 8)
|
||||
return NULL;
|
||||
|
||||
InitializeSid(psid, &sid_auth[s], cnt);
|
||||
@ -96,7 +96,7 @@ convert_string_sid_to_sid (PSID psid, const char *sid_str)
|
||||
DWORD s = 0;
|
||||
DWORD i, r[8];
|
||||
|
||||
if (! sid_str || strncmp (sid_str, "S-1-", 4))
|
||||
if (!sid_str || strncmp (sid_str, "S-1-", 4))
|
||||
return NULL;
|
||||
|
||||
strcpy (sid_buf, sid_str);
|
||||
@ -202,7 +202,7 @@ get_id_from_sid (PSID psid, BOOL search_grp, int *type)
|
||||
PSID sid = (PSID) sidbuf;
|
||||
int id = -1;
|
||||
|
||||
if (! search_grp)
|
||||
if (!search_grp)
|
||||
{
|
||||
if (passwd_sem > 0)
|
||||
return 0;
|
||||
@ -356,7 +356,7 @@ lookup_name (const char *name, const char *logsrv, PSID ret_sid)
|
||||
|
||||
debug_printf ("name : %s", name ? name : "NULL");
|
||||
|
||||
if (! name)
|
||||
if (!name)
|
||||
return FALSE;
|
||||
|
||||
if (cygheap->user.domain ())
|
||||
@ -475,7 +475,7 @@ cygwin_logon_user (const struct passwd *pw, const char *password)
|
||||
*c = '\0';
|
||||
nt_user = c + 1;
|
||||
}
|
||||
if (! LogonUserA (nt_user, nt_domain, (char *) password,
|
||||
if (!LogonUserA (nt_user, nt_domain, (char *) password,
|
||||
LOGON32_LOGON_INTERACTIVE,
|
||||
LOGON32_PROVIDER_DEFAULT,
|
||||
&hToken)
|
||||
@ -510,7 +510,7 @@ LONG
|
||||
read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size)
|
||||
{
|
||||
/* Check parameters */
|
||||
if (! sd_size)
|
||||
if (!sd_size)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
@ -529,7 +529,7 @@ read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size)
|
||||
pfile = fbuf;
|
||||
}
|
||||
|
||||
if (! GetFileSecurity (pfile,
|
||||
if (!GetFileSecurity (pfile,
|
||||
OWNER_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| DACL_SECURITY_INFORMATION,
|
||||
@ -551,7 +551,7 @@ LONG
|
||||
write_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size)
|
||||
{
|
||||
/* Check parameters */
|
||||
if (! sd_buf || ! sd_size)
|
||||
if (!sd_buf || !sd_size)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
@ -632,13 +632,13 @@ set_process_privileges ()
|
||||
TOKEN_PRIVILEGES new_priv;
|
||||
int ret = -1;
|
||||
|
||||
if (! OpenProcessToken (hMainProc, TOKEN_ADJUST_PRIVILEGES, &hToken))
|
||||
if (!OpenProcessToken (hMainProc, TOKEN_ADJUST_PRIVILEGES, &hToken))
|
||||
{
|
||||
__seterrno ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (! LookupPrivilegeValue (NULL, SE_RESTORE_NAME, &restore_priv))
|
||||
if (!LookupPrivilegeValue (NULL, SE_RESTORE_NAME, &restore_priv))
|
||||
{
|
||||
__seterrno ();
|
||||
goto out;
|
||||
@ -648,7 +648,7 @@ set_process_privileges ()
|
||||
new_priv.Privileges[0].Luid = restore_priv;
|
||||
new_priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||
|
||||
if (! AdjustTokenPrivileges (hToken, FALSE, &new_priv, 0, NULL, NULL))
|
||||
if (!AdjustTokenPrivileges (hToken, FALSE, &new_priv, 0, NULL, NULL))
|
||||
{
|
||||
__seterrno ();
|
||||
goto out;
|
||||
@ -673,7 +673,7 @@ get_nt_attribute (const char *file, int *attribute,
|
||||
|
||||
syscall_printf ("file: %s", file);
|
||||
|
||||
/* Yeah, sounds too much, but I've seen SDs of 2100 bytes! */
|
||||
/* Yeah, sounds too much, but I've seen SDs of 2100 bytes!*/
|
||||
DWORD sd_size = 4096;
|
||||
char sd_buf[4096];
|
||||
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) sd_buf;
|
||||
@ -689,15 +689,15 @@ get_nt_attribute (const char *file, int *attribute,
|
||||
PSID group_sid;
|
||||
BOOL dummy;
|
||||
|
||||
if (! GetSecurityDescriptorOwner (psd, &owner_sid, &dummy))
|
||||
if (!GetSecurityDescriptorOwner (psd, &owner_sid, &dummy))
|
||||
debug_printf ("GetSecurityDescriptorOwner %E");
|
||||
if (! GetSecurityDescriptorGroup (psd, &group_sid, &dummy))
|
||||
if (!GetSecurityDescriptorGroup (psd, &group_sid, &dummy))
|
||||
debug_printf ("GetSecurityDescriptorGroup %E");
|
||||
|
||||
PACL acl;
|
||||
BOOL acl_exists;
|
||||
|
||||
if (! GetSecurityDescriptorDacl (psd, &acl_exists, &acl, &dummy))
|
||||
if (!GetSecurityDescriptorDacl (psd, &acl_exists, &acl, &dummy))
|
||||
{
|
||||
__seterrno ();
|
||||
debug_printf ("GetSecurityDescriptorDacl %E");
|
||||
@ -711,7 +711,7 @@ get_nt_attribute (const char *file, int *attribute,
|
||||
if (gidret)
|
||||
*gidret = gid;
|
||||
|
||||
if (! attribute)
|
||||
if (!attribute)
|
||||
{
|
||||
syscall_printf ("file: %s uid %d, gid %d", file, uid, gid);
|
||||
return 0;
|
||||
@ -719,7 +719,7 @@ get_nt_attribute (const char *file, int *attribute,
|
||||
|
||||
BOOL grp_member = is_grp_member (uid, gid);
|
||||
|
||||
if (! acl_exists || ! acl)
|
||||
if (!acl_exists || !acl)
|
||||
{
|
||||
*attribute |= S_IRWXU | S_IRWXG | S_IRWXO;
|
||||
syscall_printf ("file: %s No ACL = %x, uid %d, gid %d",
|
||||
@ -790,7 +790,7 @@ get_nt_attribute (const char *file, int *attribute,
|
||||
| ((!(*anti & S_IXGRP)) ? S_IXGRP : 0)
|
||||
| ((!(*anti & S_IXUSR)) ? S_IXUSR : 0);
|
||||
/* Sticky bit for directories according to linux rules. */
|
||||
if (! (ace->Mask & FILE_DELETE_CHILD)
|
||||
if (!(ace->Mask & FILE_DELETE_CHILD)
|
||||
&& S_ISDIR(*attribute)
|
||||
&& !(*anti & S_ISVTX))
|
||||
*flags |= S_ISVTX;
|
||||
@ -816,13 +816,13 @@ get_file_attribute (int use_ntsec, const char *file,
|
||||
if (gidret)
|
||||
*gidret = getgid ();
|
||||
|
||||
if (! attribute)
|
||||
if (!attribute)
|
||||
return 0;
|
||||
|
||||
int res = NTReadEA (file, ".UNIXATTR",
|
||||
(char *) attribute, sizeof (*attribute));
|
||||
|
||||
/* symlinks are everything for everyone! */
|
||||
/* symlinks are everything for everyone!*/
|
||||
if ((*attribute & S_IFLNK) == S_IFLNK)
|
||||
*attribute |= S_IRWXU | S_IRWXG | S_IRWXO;
|
||||
|
||||
@ -834,7 +834,7 @@ get_file_attribute (int use_ntsec, const char *file,
|
||||
BOOL add_access_allowed_ace (PACL acl, int offset, DWORD attributes,
|
||||
PSID sid, size_t &len_add, DWORD inherit)
|
||||
{
|
||||
if (! AddAccessAllowedAce (acl, ACL_REVISION, attributes, sid))
|
||||
if (!AddAccessAllowedAce (acl, ACL_REVISION, attributes, sid))
|
||||
{
|
||||
__seterrno ();
|
||||
return FALSE;
|
||||
@ -850,7 +850,7 @@ BOOL add_access_allowed_ace (PACL acl, int offset, DWORD attributes,
|
||||
BOOL add_access_denied_ace (PACL acl, int offset, DWORD attributes,
|
||||
PSID sid, size_t &len_add, DWORD inherit)
|
||||
{
|
||||
if (! AddAccessDeniedAce (acl, ACL_REVISION, attributes, sid))
|
||||
if (!AddAccessDeniedAce (acl, ACL_REVISION, attributes, sid))
|
||||
{
|
||||
__seterrno ();
|
||||
return FALSE;
|
||||
@ -872,7 +872,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
if (os_being_run != winNT)
|
||||
return NULL;
|
||||
|
||||
if (! sd_ret || ! sd_size_ret)
|
||||
if (!sd_ret || !sd_size_ret)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return NULL;
|
||||
@ -885,8 +885,8 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
struct passwd *pw = getpwuid (uid);
|
||||
strcpy (owner, pw ? pw->pw_name : getlogin ());
|
||||
owner_sid = (PSID) owner_sid_buf;
|
||||
if ((! pw || ! get_pw_sid (owner_sid, pw))
|
||||
&& ! lookup_name (owner, logsrv, owner_sid))
|
||||
if ((!pw || !get_pw_sid (owner_sid, pw))
|
||||
&& !lookup_name (owner, logsrv, owner_sid))
|
||||
return NULL;
|
||||
debug_printf ("owner: %s [%d]", owner,
|
||||
*GetSidSubAuthority((PSID) owner_sid,
|
||||
@ -899,8 +899,8 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
if (grp)
|
||||
{
|
||||
group_sid = (PSID) group_sid_buf;
|
||||
if ((! grp || ! get_gr_sid (group_sid, grp))
|
||||
&& ! lookup_name (grp->gr_name, logsrv, group_sid))
|
||||
if ((!grp || !get_gr_sid (group_sid, grp))
|
||||
&& !lookup_name (grp->gr_name, logsrv, group_sid))
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
@ -909,7 +909,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
/* Initialize local security descriptor. */
|
||||
SECURITY_DESCRIPTOR sd;
|
||||
PSECURITY_DESCRIPTOR psd = NULL;
|
||||
if (! InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION))
|
||||
if (!InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION))
|
||||
{
|
||||
__seterrno ();
|
||||
return NULL;
|
||||
@ -931,14 +931,14 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
SetSecurityDescriptorControl (&sd, SE_DACL_PROTECTED, SE_DACL_PROTECTED);
|
||||
|
||||
/* Create owner for local security descriptor. */
|
||||
if (! SetSecurityDescriptorOwner(&sd, owner_sid, FALSE))
|
||||
if (!SetSecurityDescriptorOwner(&sd, owner_sid, FALSE))
|
||||
{
|
||||
__seterrno ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create group for local security descriptor. */
|
||||
if (group_sid && ! SetSecurityDescriptorGroup(&sd, group_sid, FALSE))
|
||||
if (group_sid && !SetSecurityDescriptorGroup(&sd, group_sid, FALSE))
|
||||
{
|
||||
__seterrno ();
|
||||
return NULL;
|
||||
@ -947,7 +947,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
/* Initialize local access control list. */
|
||||
char acl_buf[3072];
|
||||
PACL acl = (PACL) acl_buf;
|
||||
if (! InitializeAcl (acl, 3072, ACL_REVISION))
|
||||
if (!InitializeAcl (acl, 3072, ACL_REVISION))
|
||||
{
|
||||
__seterrno ();
|
||||
return NULL;
|
||||
@ -958,9 +958,9 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
* For correct handling under WinNT, FILE_DELETE_CHILD has to
|
||||
* be (un)set in each ACE.
|
||||
*/
|
||||
if (! (attribute & S_IXOTH))
|
||||
if (!(attribute & S_IXOTH))
|
||||
attribute &= ~S_ISVTX;
|
||||
if (! (attribute & S_IFDIR))
|
||||
if (!(attribute & S_IFDIR))
|
||||
attribute |= S_ISVTX;
|
||||
|
||||
/* From here fill ACL. */
|
||||
@ -976,7 +976,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
owner_allow |= FILE_GENERIC_WRITE | DELETE;
|
||||
if (attribute & S_IXUSR)
|
||||
owner_allow |= FILE_GENERIC_EXECUTE;
|
||||
if (! (attribute & S_ISVTX))
|
||||
if (!(attribute & S_ISVTX))
|
||||
owner_allow |= FILE_DELETE_CHILD;
|
||||
|
||||
/* Construct allow attribute for group. */
|
||||
@ -988,7 +988,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
group_allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE | DELETE;
|
||||
if (attribute & S_IXGRP)
|
||||
group_allow |= FILE_GENERIC_EXECUTE;
|
||||
if (! (attribute & S_ISVTX))
|
||||
if (!(attribute & S_ISVTX))
|
||||
group_allow |= FILE_DELETE_CHILD;
|
||||
|
||||
/* Construct allow attribute for everyone. */
|
||||
@ -1000,7 +1000,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
other_allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE | DELETE;
|
||||
if (attribute & S_IXOTH)
|
||||
other_allow |= FILE_GENERIC_EXECUTE;
|
||||
if (! (attribute & S_ISVTX))
|
||||
if (!(attribute & S_ISVTX))
|
||||
other_allow |= FILE_DELETE_CHILD;
|
||||
|
||||
/* Construct deny attributes for owner and group. */
|
||||
@ -1020,29 +1020,29 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
|
||||
/* Set deny ACE for owner. */
|
||||
if (owner_deny
|
||||
&& ! add_access_denied_ace (acl, ace_off++, owner_deny,
|
||||
&& !add_access_denied_ace (acl, ace_off++, owner_deny,
|
||||
owner_sid, acl_len, inherit))
|
||||
return NULL;
|
||||
/* Set allow ACE for owner. */
|
||||
if (! add_access_allowed_ace (acl, ace_off++, owner_allow,
|
||||
if (!add_access_allowed_ace (acl, ace_off++, owner_allow,
|
||||
owner_sid, acl_len, inherit))
|
||||
return NULL;
|
||||
/* Set deny ACE for group. */
|
||||
if (group_deny
|
||||
&& ! add_access_denied_ace (acl, ace_off++, group_deny,
|
||||
&& !add_access_denied_ace (acl, ace_off++, group_deny,
|
||||
group_sid, acl_len, inherit))
|
||||
return NULL;
|
||||
/* Set allow ACE for group. */
|
||||
if (! add_access_allowed_ace (acl, ace_off++, group_allow,
|
||||
if (!add_access_allowed_ace (acl, ace_off++, group_allow,
|
||||
group_sid, acl_len, inherit))
|
||||
return NULL;
|
||||
|
||||
/* Get owner and group from current security descriptor. */
|
||||
PSID cur_owner_sid = NULL;
|
||||
PSID cur_group_sid = NULL;
|
||||
if (! GetSecurityDescriptorOwner (sd_ret, &cur_owner_sid, &dummy))
|
||||
if (!GetSecurityDescriptorOwner (sd_ret, &cur_owner_sid, &dummy))
|
||||
debug_printf ("GetSecurityDescriptorOwner %E");
|
||||
if (! GetSecurityDescriptorGroup (sd_ret, &cur_group_sid, &dummy))
|
||||
if (!GetSecurityDescriptorGroup (sd_ret, &cur_group_sid, &dummy))
|
||||
debug_printf ("GetSecurityDescriptorGroup %E");
|
||||
|
||||
/* Fill ACL with unrelated ACEs from current security descriptor. */
|
||||
@ -1067,7 +1067,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
* behind the owner_deny, ACCESS_ALLOWED_ACE to the end
|
||||
* but in front of the `everyone' ACE.
|
||||
*/
|
||||
if (! AddAce(acl, ACL_REVISION,
|
||||
if (!AddAce(acl, ACL_REVISION,
|
||||
ace->Header.AceType == ACCESS_DENIED_ACE_TYPE ?
|
||||
(owner_deny ? 1 : 0) : MAXDWORD,
|
||||
(LPVOID) ace, ace->Header.AceSize))
|
||||
@ -1080,7 +1080,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
}
|
||||
|
||||
/* Set allow ACE for everyone. */
|
||||
if (! add_access_allowed_ace (acl, ace_off++, other_allow,
|
||||
if (!add_access_allowed_ace (acl, ace_off++, other_allow,
|
||||
get_world_sid (), acl_len, inherit))
|
||||
return NULL;
|
||||
|
||||
@ -1089,7 +1089,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
debug_printf ("ACL-Size: %d", acl_len);
|
||||
|
||||
/* Create DACL for local security descriptor. */
|
||||
if (! SetSecurityDescriptorDacl (&sd, TRUE, acl, FALSE))
|
||||
if (!SetSecurityDescriptorDacl (&sd, TRUE, acl, FALSE))
|
||||
{
|
||||
__seterrno ();
|
||||
return NULL;
|
||||
@ -1103,7 +1103,7 @@ alloc_sd (uid_t uid, gid_t gid, const char *logsrv, int attribute,
|
||||
__seterrno ();
|
||||
return NULL;
|
||||
}
|
||||
if (! MakeSelfRelativeSD (&sd, sd_ret, sd_size_ret))
|
||||
if (!MakeSelfRelativeSD (&sd, sd_ret, sd_size_ret))
|
||||
{
|
||||
__seterrno ();
|
||||
return NULL;
|
||||
@ -1133,7 +1133,7 @@ set_nt_attribute (const char *file, uid_t uid, gid_t gid,
|
||||
}
|
||||
|
||||
sd_size = 4096;
|
||||
if (! (psd = alloc_sd (uid, gid, logsrv, attribute, psd, &sd_size)))
|
||||
if (!(psd = alloc_sd (uid, gid, logsrv, attribute, psd, &sd_size)))
|
||||
return -1;
|
||||
|
||||
return write_sd (file, psd, sd_size);
|
||||
@ -1144,13 +1144,13 @@ set_file_attribute (int use_ntsec, const char *file,
|
||||
uid_t uid, gid_t gid,
|
||||
int attribute, const char *logsrv)
|
||||
{
|
||||
/* symlinks are anything for everyone! */
|
||||
/* symlinks are anything for everyone!*/
|
||||
if ((attribute & S_IFLNK) == S_IFLNK)
|
||||
attribute |= S_IRWXU | S_IRWXG | S_IRWXO;
|
||||
|
||||
if (!use_ntsec || !allow_ntsec)
|
||||
{
|
||||
if (! NTWriteEA (file, ".UNIXATTR",
|
||||
if (!NTWriteEA (file, ".UNIXATTR",
|
||||
(char *) &attribute, sizeof (attribute)))
|
||||
{
|
||||
__seterrno ();
|
||||
@ -1202,7 +1202,7 @@ setacl (const char *file, int nentries, aclent_t *aclbufp)
|
||||
|
||||
/* Get owner SID. */
|
||||
PSID owner_sid = NULL;
|
||||
if (! GetSecurityDescriptorOwner (psd, &owner_sid, &dummy))
|
||||
if (!GetSecurityDescriptorOwner (psd, &owner_sid, &dummy))
|
||||
{
|
||||
__seterrno ();
|
||||
return -1;
|
||||
@ -1217,7 +1217,7 @@ setacl (const char *file, int nentries, aclent_t *aclbufp)
|
||||
|
||||
/* Get group SID. */
|
||||
PSID group_sid = NULL;
|
||||
if (! GetSecurityDescriptorGroup (psd, &group_sid, &dummy))
|
||||
if (!GetSecurityDescriptorGroup (psd, &group_sid, &dummy))
|
||||
{
|
||||
__seterrno ();
|
||||
return -1;
|
||||
@ -1232,18 +1232,18 @@ setacl (const char *file, int nentries, aclent_t *aclbufp)
|
||||
|
||||
/* Initialize local security descriptor. */
|
||||
SECURITY_DESCRIPTOR sd;
|
||||
if (! InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION))
|
||||
if (!InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION))
|
||||
{
|
||||
__seterrno ();
|
||||
return -1;
|
||||
}
|
||||
if (! SetSecurityDescriptorOwner(&sd, owner_sid, FALSE))
|
||||
if (!SetSecurityDescriptorOwner(&sd, owner_sid, FALSE))
|
||||
{
|
||||
__seterrno ();
|
||||
return -1;
|
||||
}
|
||||
if (group_sid
|
||||
&& ! SetSecurityDescriptorGroup(&sd, group_sid, FALSE))
|
||||
&& !SetSecurityDescriptorGroup(&sd, group_sid, FALSE))
|
||||
{
|
||||
__seterrno ();
|
||||
return -1;
|
||||
@ -1261,7 +1261,7 @@ setacl (const char *file, int nentries, aclent_t *aclbufp)
|
||||
struct group *gr;
|
||||
int pos;
|
||||
|
||||
if (! InitializeAcl (acl, 3072, ACL_REVISION))
|
||||
if (!InitializeAcl (acl, 3072, ACL_REVISION))
|
||||
{
|
||||
__seterrno ();
|
||||
return -1;
|
||||
@ -1302,35 +1302,35 @@ setacl (const char *file, int nentries, aclent_t *aclbufp)
|
||||
case USER_OBJ:
|
||||
case DEF_USER_OBJ:
|
||||
allow |= STANDARD_RIGHTS_ALL & ~DELETE;
|
||||
if (! add_access_allowed_ace (acl, ace_off++, allow,
|
||||
if (!add_access_allowed_ace (acl, ace_off++, allow,
|
||||
owner_sid, acl_len, inheritance))
|
||||
return -1;
|
||||
break;
|
||||
case USER:
|
||||
case DEF_USER:
|
||||
if (!(pw = getpwuid (aclbufp[i].a_id))
|
||||
|| ! get_pw_sid (sid, pw)
|
||||
|| ! add_access_allowed_ace (acl, ace_off++, allow,
|
||||
|| !get_pw_sid (sid, pw)
|
||||
|| !add_access_allowed_ace (acl, ace_off++, allow,
|
||||
sid, acl_len, inheritance))
|
||||
return -1;
|
||||
break;
|
||||
case GROUP_OBJ:
|
||||
case DEF_GROUP_OBJ:
|
||||
if (! add_access_allowed_ace (acl, ace_off++, allow,
|
||||
if (!add_access_allowed_ace (acl, ace_off++, allow,
|
||||
group_sid, acl_len, inheritance))
|
||||
return -1;
|
||||
break;
|
||||
case GROUP:
|
||||
case DEF_GROUP:
|
||||
if (!(gr = getgrgid (aclbufp[i].a_id))
|
||||
|| ! get_gr_sid (sid, gr)
|
||||
|| ! add_access_allowed_ace (acl, ace_off++, allow,
|
||||
|| !get_gr_sid (sid, gr)
|
||||
|| !add_access_allowed_ace (acl, ace_off++, allow,
|
||||
sid, acl_len, inheritance))
|
||||
return -1;
|
||||
break;
|
||||
case OTHER_OBJ:
|
||||
case DEF_OTHER_OBJ:
|
||||
if (! add_access_allowed_ace (acl, ace_off++, allow,
|
||||
if (!add_access_allowed_ace (acl, ace_off++, allow,
|
||||
get_world_sid(), acl_len, inheritance))
|
||||
return -1;
|
||||
break;
|
||||
@ -1340,7 +1340,7 @@ setacl (const char *file, int nentries, aclent_t *aclbufp)
|
||||
acl->AclSize = acl_len;
|
||||
debug_printf ("ACL-Size: %d", acl_len);
|
||||
/* Create DACL for local security descriptor. */
|
||||
if (! SetSecurityDescriptorDacl (&sd, TRUE, acl, FALSE))
|
||||
if (!SetSecurityDescriptorDacl (&sd, TRUE, acl, FALSE))
|
||||
{
|
||||
__seterrno ();
|
||||
return -1;
|
||||
@ -1353,7 +1353,7 @@ setacl (const char *file, int nentries, aclent_t *aclbufp)
|
||||
__seterrno ();
|
||||
return -1;
|
||||
}
|
||||
if (! MakeSelfRelativeSD (&sd, psd, &sd_size))
|
||||
if (!MakeSelfRelativeSD (&sd, psd, &sd_size))
|
||||
{
|
||||
__seterrno ();
|
||||
return -1;
|
||||
@ -1407,7 +1407,7 @@ getacl (const char *file, DWORD attr, int nentries, aclent_t *aclbufp)
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
|
||||
if (! GetSecurityDescriptorOwner (psd, &owner_sid, &dummy))
|
||||
if (!GetSecurityDescriptorOwner (psd, &owner_sid, &dummy))
|
||||
{
|
||||
debug_printf ("GetSecurityDescriptorOwner %E");
|
||||
__seterrno ();
|
||||
@ -1415,7 +1415,7 @@ getacl (const char *file, DWORD attr, int nentries, aclent_t *aclbufp)
|
||||
}
|
||||
uid = get_uid_from_sid (owner_sid);
|
||||
|
||||
if (! GetSecurityDescriptorGroup (psd, &group_sid, &dummy))
|
||||
if (!GetSecurityDescriptorGroup (psd, &group_sid, &dummy))
|
||||
{
|
||||
debug_printf ("GetSecurityDescriptorGroup %E");
|
||||
__seterrno ();
|
||||
@ -1434,7 +1434,7 @@ getacl (const char *file, DWORD attr, int nentries, aclent_t *aclbufp)
|
||||
PACL acl;
|
||||
BOOL acl_exists;
|
||||
|
||||
if (! GetSecurityDescriptorDacl (psd, &acl_exists, &acl, &dummy))
|
||||
if (!GetSecurityDescriptorDacl (psd, &acl_exists, &acl, &dummy))
|
||||
{
|
||||
__seterrno ();
|
||||
debug_printf ("GetSecurityDescriptorDacl %E");
|
||||
@ -1443,7 +1443,7 @@ getacl (const char *file, DWORD attr, int nentries, aclent_t *aclbufp)
|
||||
|
||||
int pos, i;
|
||||
|
||||
if (! acl_exists || ! acl)
|
||||
if (!acl_exists || !acl)
|
||||
{
|
||||
for (pos = 0; pos < MIN_ACL_ENTRIES; ++pos)
|
||||
lacl[pos].a_perm = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||
@ -1591,7 +1591,7 @@ acl_access (const char *path, int flags)
|
||||
endgrent ();
|
||||
}
|
||||
--group_sem;
|
||||
if (! gr)
|
||||
if (!gr)
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@ -1641,8 +1641,8 @@ acl_worker (const char *path, int cmd, int nentries, aclent_t *aclbufp,
|
||||
case GETACL:
|
||||
if (nentries < 1)
|
||||
set_errno (EINVAL);
|
||||
else if ((nofollow && ! lstat (path, &st))
|
||||
|| (!nofollow && ! stat (path, &st)))
|
||||
else if ((nofollow && !lstat (path, &st))
|
||||
|| (!nofollow && !stat (path, &st)))
|
||||
{
|
||||
aclent_t lacl[4];
|
||||
if (nentries > 0)
|
||||
@ -1916,7 +1916,7 @@ acltomode (aclent_t *aclbufp, int nentries, mode_t *modep)
|
||||
{
|
||||
int pos;
|
||||
|
||||
if (!aclbufp || nentries < 1 || ! modep)
|
||||
if (!aclbufp || nentries < 1 || !modep)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
@ -1951,7 +1951,7 @@ aclfrommode(aclent_t *aclbufp, int nentries, mode_t *modep)
|
||||
{
|
||||
int pos;
|
||||
|
||||
if (!aclbufp || nentries < 1 || ! modep)
|
||||
if (!aclbufp || nentries < 1 || !modep)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
|
@ -27,9 +27,8 @@ details. */
|
||||
cygwin_version.api_minor)
|
||||
|
||||
shared_info NO_COPY *cygwin_shared = NULL;
|
||||
|
||||
/* The handle of the shared data area. */
|
||||
HANDLE cygwin_shared_h = NULL;
|
||||
mount_info NO_COPY *mount_table = NULL;
|
||||
HANDLE cygwin_mount_h = NULL;
|
||||
|
||||
/* General purpose security attribute objects for global use. */
|
||||
SECURITY_ATTRIBUTES NO_COPY sec_none;
|
||||
@ -49,15 +48,24 @@ shared_name (const char *str, int num)
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Open the shared memory map. */
|
||||
static void __stdcall
|
||||
open_shared_file_map ()
|
||||
static void
|
||||
mount_table_init ()
|
||||
{
|
||||
cygwin_shared = (shared_info *) open_shared ("shared",
|
||||
cygwin_shared_h,
|
||||
sizeof (*cygwin_shared),
|
||||
(void *)0xa000000);
|
||||
ProtectHandle (cygwin_shared);
|
||||
void *addr = mount_table_address;
|
||||
debug_printf ("opening mount table for '%s' at %p", cygheap->user.name (),
|
||||
mount_table_address);
|
||||
mount_table = (mount_info *) open_shared (cygheap->user.name (),
|
||||
cygwin_mount_h, sizeof (mount_info),
|
||||
addr);
|
||||
ProtectHandle (cygwin_mount_h);
|
||||
|
||||
debug_printf ("mount table version %x at %p", mount_table->version, mount_table);
|
||||
if (!mount_table->version)
|
||||
{
|
||||
mount_table->version = MOUNT_VERSION;
|
||||
debug_printf ("initializing mount table");
|
||||
mount_table->init (); /* Initialize the mount table. */
|
||||
}
|
||||
}
|
||||
|
||||
void * __stdcall
|
||||
@ -99,9 +107,9 @@ open_shared (const char *name, HANDLE &shared_h, DWORD size, void *addr)
|
||||
}
|
||||
|
||||
if (!shared)
|
||||
api_fatal ("MapViewOfFileEx, %E. Terminating.");
|
||||
api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", name, shared_h);
|
||||
|
||||
debug_printf ("name %s, shared %p, h %p", name, shared, shared_h);
|
||||
debug_printf ("name %s, shared %p (wanted %p), h %p", name, shared, addr, shared_h);
|
||||
|
||||
/* FIXME: I couldn't find anywhere in the documentation a note about
|
||||
whether the memory is initialized to zero. The code assumes it does
|
||||
@ -124,9 +132,6 @@ shared_info::initialize ()
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize the mount table. */
|
||||
mount.init ();
|
||||
|
||||
/* Initialize the queue of deleted files. */
|
||||
delqueue.init ();
|
||||
|
||||
@ -155,16 +160,28 @@ shared_info::initialize ()
|
||||
void __stdcall
|
||||
shared_init ()
|
||||
{
|
||||
open_shared_file_map ();
|
||||
HANDLE shared_h = cygheap ? cygheap->shared_h : NULL;
|
||||
cygwin_shared = (shared_info *) open_shared ("shared",
|
||||
shared_h,
|
||||
sizeof (*cygwin_shared),
|
||||
cygwin_shared_address);
|
||||
if (!cygheap)
|
||||
cygheap_init ();
|
||||
|
||||
mount_table_init ();
|
||||
|
||||
cygheap->shared_h = shared_h;
|
||||
ProtectHandle (cygheap->shared_h);
|
||||
cygwin_shared->initialize ();
|
||||
}
|
||||
|
||||
void __stdcall
|
||||
shared_terminate ()
|
||||
{
|
||||
if (cygwin_shared_h)
|
||||
ForceCloseHandle (cygwin_shared_h);
|
||||
if (cygheap->shared_h)
|
||||
ForceCloseHandle (cygheap->shared_h);
|
||||
if (cygwin_mount_h)
|
||||
ForceCloseHandle (cygwin_mount_h);
|
||||
}
|
||||
|
||||
unsigned
|
||||
@ -292,4 +309,3 @@ sec_user_nih (PVOID sa_buf, PSID sid2)
|
||||
{
|
||||
return sec_user (sa_buf, sid2, FALSE);
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,13 @@ public:
|
||||
scheme should be satisfactory for a long while yet. */
|
||||
#define MAX_MOUNTS 30
|
||||
|
||||
#define MOUNT_VERSION 0x01010102
|
||||
|
||||
class reg_key;
|
||||
class mount_info
|
||||
{
|
||||
int posix_sorted[MAX_MOUNTS];
|
||||
int native_sorted[MAX_MOUNTS];
|
||||
public:
|
||||
DWORD version;
|
||||
int nmounts;
|
||||
mount_item mount[MAX_MOUNTS];
|
||||
|
||||
@ -61,7 +62,11 @@ public:
|
||||
char cygdrive[MAX_PATH];
|
||||
size_t cygdrive_len;
|
||||
unsigned cygdrive_flags;
|
||||
private:
|
||||
int posix_sorted[MAX_MOUNTS];
|
||||
int native_sorted[MAX_MOUNTS];
|
||||
|
||||
public:
|
||||
/* Increment when setting up a reg_key if mounts area had to be
|
||||
created so we know when we need to import old mount tables. */
|
||||
int had_to_create_mount_areas;
|
||||
@ -135,9 +140,6 @@ class shared_info
|
||||
DWORD inited;
|
||||
|
||||
public:
|
||||
/* FIXME: Doesn't work if more than one user on system. */
|
||||
mount_info mount;
|
||||
|
||||
int heap_chunk_in_mb;
|
||||
unsigned heap_chunk_size (void);
|
||||
|
||||
@ -147,11 +149,20 @@ public:
|
||||
};
|
||||
|
||||
extern shared_info *cygwin_shared;
|
||||
extern HANDLE cygwin_shared_h;
|
||||
extern HANDLE console_shared_h;
|
||||
extern mount_info *mount_table;
|
||||
extern HANDLE cygwin_mount_h;
|
||||
|
||||
void __stdcall shared_init (void);
|
||||
void __stdcall shared_terminate (void);
|
||||
|
||||
#define shared_align_past(p) \
|
||||
((char *) (system_info.dwAllocationGranularity * \
|
||||
(((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
|
||||
system_info.dwAllocationGranularity)))
|
||||
|
||||
#define cygwin_shared_address ((void *) 0xa000000)
|
||||
#define mount_table_address shared_align_past (cygwin_shared)
|
||||
#define cygheap_address shared_align_past ((mount_info *) shared_align_past (cygwin_shared))
|
||||
|
||||
char *__stdcall shared_name (const char *, int);
|
||||
void *__stdcall open_shared (const char *name, HANDLE &shared_h, DWORD size, void *addr);
|
||||
|
@ -821,8 +821,6 @@ init_child_info (DWORD chtype, child_info *ch, pid_t pid, HANDLE subproc_ready)
|
||||
ch->cb = sizeof *ch;
|
||||
ch->type = chtype;
|
||||
ch->cygpid = pid;
|
||||
ch->shared_h = cygwin_shared_h;
|
||||
ch->console_h = console_shared_h;
|
||||
ch->subproc_ready = subproc_ready;
|
||||
ch->pppid_handle = myself->ppid_handle;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ details. */
|
||||
#include "sigproc.h"
|
||||
#include "cygheap.h"
|
||||
#include "child_info.h"
|
||||
#include "shared_info.h"
|
||||
#include "pinfo.h"
|
||||
#define NEED_VFORK
|
||||
#include "perthread.h"
|
||||
@ -592,6 +593,9 @@ skip_arg_parsing:
|
||||
if (!hToken)
|
||||
{
|
||||
ciresrv.moreinfo->uid = getuid ();
|
||||
/* FIXME: This leaks a handle in the CreateProcessAsUser case since the
|
||||
child process doesn't know about cygwin_mount_h. */
|
||||
ciresrv.mount_h = cygwin_mount_h;
|
||||
rc = CreateProcess (runpath, /* image name - with full path */
|
||||
one_line.buf, /* what was passed to exec */
|
||||
/* process security attrs */
|
||||
|
@ -38,6 +38,8 @@ details. */
|
||||
#include "security.h"
|
||||
#include "cygheap.h"
|
||||
|
||||
SYSTEM_INFO system_info;
|
||||
|
||||
/* Close all files and process any queued deletions.
|
||||
Lots of unix style applications will open a tmp file, unlink it,
|
||||
but never call close. This function is called by _exit to
|
||||
@ -835,7 +837,7 @@ chmod (const char *path, mode_t mode)
|
||||
NULL, &uid, &gid);
|
||||
if (win32_path.file_attributes () & FILE_ATTRIBUTE_DIRECTORY)
|
||||
mode |= S_IFDIR;
|
||||
if (! set_file_attribute (win32_path.has_acls (),
|
||||
if (!set_file_attribute (win32_path.has_acls (),
|
||||
win32_path.get_win32 (),
|
||||
uid, gid,
|
||||
mode, cygheap->user.logsrv ())
|
||||
@ -1233,8 +1235,8 @@ _rename (const char *oldpath, const char *newpath)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (! writable_directory (real_old.get_win32 ())
|
||||
|| ! writable_directory (real_new.get_win32 ()))
|
||||
if (!writable_directory (real_old.get_win32 ())
|
||||
|| !writable_directory (real_new.get_win32 ()))
|
||||
{
|
||||
syscall_printf ("-1 = rename (%s, %s)", oldpath, newpath);
|
||||
return -1;
|
||||
@ -1360,15 +1362,9 @@ getdtablesize ()
|
||||
extern "C" size_t
|
||||
getpagesize ()
|
||||
{
|
||||
static DWORD sys_page_size = 0;
|
||||
|
||||
if (!sys_page_size)
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
sys_page_size = si.dwPageSize;
|
||||
}
|
||||
return (int)sys_page_size;
|
||||
if (!system_info.dwPageSize)
|
||||
GetSystemInfo(&system_info);
|
||||
return (int) system_info.dwPageSize;
|
||||
}
|
||||
|
||||
/* FIXME: not all values are correct... */
|
||||
@ -1952,8 +1948,7 @@ chroot (const char *newroot)
|
||||
goto done;
|
||||
}
|
||||
char buf[MAX_PATH + 1];
|
||||
ret = cygwin_shared->mount.conv_to_posix_path (path.get_win32 (),
|
||||
buf, 0);
|
||||
ret = mount_table->conv_to_posix_path (path.get_win32 (), buf, 0);
|
||||
if (ret)
|
||||
{
|
||||
set_errno (ret);
|
||||
|
@ -31,10 +31,12 @@ internal_getlogin (cygheap_user &user)
|
||||
char username[MAX_USER_NAME];
|
||||
DWORD username_len = MAX_USER_NAME;
|
||||
|
||||
if (! GetUserName (username, &username_len))
|
||||
user.set_name ("unknown");
|
||||
else
|
||||
user.set_name (username);
|
||||
if (!user.name ())
|
||||
if (!GetUserName (username, &username_len))
|
||||
user.set_name ("unknown");
|
||||
else
|
||||
user.set_name (username);
|
||||
|
||||
if (os_being_run == winNT)
|
||||
{
|
||||
LPWKSTA_USER_INFO_1 wui;
|
||||
|
@ -234,6 +234,7 @@ extern DWORD binmode;
|
||||
extern char _data_start__, _data_end__, _bss_start__, _bss_end__;
|
||||
extern void (*__CTOR_LIST__) (void);
|
||||
extern void (*__DTOR_LIST__) (void);
|
||||
extern SYSTEM_INFO system_info;
|
||||
};
|
||||
|
||||
/*************************** Unsorted ******************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user