Commit Graph

304 Commits

Author SHA1 Message Date
Corinna Vinschen fc3e7da6b0 Throughout, open console handles with sharing for reading and writing.
* dcrt0.cc (insert_file): Open file with full sharing allowed.
	* hookapi.cc (find_first_notloaded_dll): Ditto.
	* spawn.cc (av::fixup): Ditto.
2011-07-04 15:25:36 +00:00
Christopher Faylor b6510ccdcd * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(child_info::old_title): Delete.
(child_info::~child_info_spawn): Remove recording of old_title.
* dcrt0.cc (title_buf): Delete.
(child_info_spawn::handle_spawn): Remove recording of old_title.
(dll_crt0_1): Get rid of all title handling.
(do_exit): Ditto.
* environ.cc (known): Delete strip_title and title.
* fhandler_console.cc (fhandler_console::write): Remove recording of old_title.
* globals.cc (exit_states): Remove ES_TITLE.
(display_title): Delete.
(strip_title_path): Delete.
(old_title): Delete.
* spawn.cc (spawn_guts): Remove old_title accommodation.
2011-06-09 21:20:27 +00:00
Christopher Faylor b86f999af1 whitespace elimination 2011-06-06 05:02:13 +00:00
Christopher Faylor 977ad5434c * dll_init.cc (dll_list::find_by_modname): New function to search the dll list
for a module name only (no path).
(dll_list::alloc): Initialize newly-added members of struct dll.
(dll_list::append): New function to factor out the append operation
(used by dll_list::topsort).
(dll_list::populate_deps): New function to identify dll dependencies.
(dll_list::topsort): New function to sort the dll list topologically by
dependencies.
(dll_list::topsort_visit): New helper function for the above.
* dll_init.h (dll::ndeps): New class member.
(dll::deps): Ditto.
(dll::modname): Ditto.
(dll_list::find_by_modname): New function related to topsort.
(dll_list::populate_all_deps): Ditto.
(dll_list::populate_deps): Ditto.
(dll_list::topsort): Ditto.
(dll_list::topsort_visit): Ditto.
(dll_list::append): Ditto.
(pefile): New struct allowing simple introspection of dll images.
* fork.cc (fork): Topologically sort the dll list before forking
* child_info.h (CURR_CHILD_INFO_MAGIC): Refresh.
(child_info::refresh_cygheap): New function.
* spawn.cc (spawn_guts): Call refresh_cygheap before creating a new process to
ensure that cygheap_max is up-to-date.
* fork.cc (frok::parent): Ditto.
2011-05-30 06:52:12 +00:00
Corinna Vinschen 8ec562ed28 * spawn.cc (spawn_guts): Only set PID_NOTCYGWIN in _P_OVERLAY mode.
Drop flag if creating new process failed.
2011-02-15 18:11:50 +00:00
Corinna Vinschen a413f8a20e * devices.in: Throughout use slashes instead of backslashes in the
native path of devices not backed by native NT devices.
	* devices.cc: Regenerate.
	* globals.cc (ro_u_pmem): Use correct case.
	(ro_u_globalroot): New R/O unicode string.
	* path.cc (path_conv::check): Fix incorrect handling of /proc/sys
	block devices if they are just visited due to a component check.
	(symlink_info::posixify): Fix typo in comment.
	(cygwin_conv_path): Use ro_u_globalroot instead of string constant.
	(fast_cwd_version): New shared variable to store FAST_CWD version
	used on the system.
	(find_fast_cwd_pointer): Rename from find_fast_cwd_pointers.  Don't
	set global fast_cwd_ptr pointer here.  Return pointer value instead.
	(find_fast_cwd): New function to set fast_cwd_ptr and fast_cwd_version.
	(cwdstuff::override_win32_cwd): Call find_fast_cwd from here.
	Check for fast_cwd_version to differ between old and new FAST_CWD
	structure.  Check old_cwd for NULL to avoid SEGV.  Don't set CWD if
	we have neitehr a valid fast_cwd_ptr, nor a valid CWD handle in the
	process parameter block.
	(cwdstuff::set): Create Win32 path taking /proc/sys paths into account.
	* spawn.cc (spawn_guts): Recode creating runpath.  Also take /proc/sys
	paths into account.  Drop special CWD handling when starting non-Cygwin
	processes.
2011-02-15 15:25:59 +00:00
Corinna Vinschen 2aba945c95 * exec.cc: Include pinfo.h.
* winf.h: Move definitions of _P_PATH_TYPE_EXEC and _P_MODE from here...
	* pinfo.h: ...to here.
	(_P_PATH_TYPE_EXEC): Redefine to be bigger than _P_SYSTEM.
	(_P_MODE): Redefine so as not to mask out _P_SYSTEM.
	* spawn.cc (spawnlp): Add _P_PATH_TYPE_EXEC flag in call to spawnve.
	(spawnlpe): Ditto.
	(spawnvp): Ditto.
2011-01-20 11:09:21 +00:00
Corinna Vinschen 9b68968b21 * spawn.cc (av::fixup): Reenable #! handling for all exec functions.
Return ENOEXEC in !p_type_exec case only for unrecognized files.
	Fix comment formatting.
2011-01-19 14:59:10 +00:00
Corinna Vinschen 26b070c0cf * exec.cc: Rearrange functions in alphabetical order.
(_execve): Drop temporary define and drop export alias.
	(execl): Call spawnve.
	(execle): New function.
	(execlp): New function.
	(execv): Call spawnve.
	(execve): Drop converting NULL envp to emtpy envp.
	(execvp): Call spawnve.
	(execvpe): Drop converting NULL envp to emtpy envp.  Call spawnve.
	(fexecve): Call spawnve.
	* spawn.cc (spawnve): Convert NULL envp to emtpy envp.  Remove outdated
	comment.
	(spawnlp): Call spawnve.
	(spawnlpe): Ditto.
	(spawnvp): Ditto.
	(spawnvpe): Fix formatting.
2011-01-19 10:28:39 +00:00
Corinna Vinschen 808aae3d13 * errno.cc (errmap): Add error codes for invalid binaries.
* exec.cc (execvp): Call spawnve with _P_PATH_TYPE_EXEC flag
	from here.
	(execvpe): Ditto.
	* spawn.cc (spawn_guts): Filter _P_PATH_TYPE_EXEC from mode and
	store in p_type_exec.  Call av::fixup with addtional p_type_exec
	argument.
	(spawnve): Check for filtered mode.
	(spawnvpe): Add _P_PATH_TYPE_EXEC flag when calling spawnve.
	(av::fixup): Accept additional bool parameter p_type_exec.  Only check
	for script if p_type_exec is true.
	* winf.h (_P_PATH_TYPE_EXEC): Define.
	(_P_MODE): Define.
	(av::fixup): Declare with additional bool parameter.
2011-01-19 09:15:17 +00:00
Christopher Faylor df4d2bea3d * include/sys/cygwin.h (PID_NOTCYGWIN): New enum.
* spawn.cc (spawn_guts): Set a flag when a process is not a cygwin process.
* fhandler_tty.cc (fhandler_tty_slave::init): Remove previous change.  Try a
different method to determine when we should become the process group owner.
* signal.cc (kill0): Remove archaic code which dealt with never-set flag.
2010-09-20 22:28:57 +00:00
Corinna Vinschen 260b80740e * cygheap.h (class cwdstuff): Make drive_length private.
Add "error" member.
	(cwdstuff::get_error): New inline method.
	(cwdstuff::get_error_desc): Declare.
	(cwdstuff::set): Change first parameter to pointer to path_conv.
	* path.cc (chdir): Drop doit.  Align call to cwdstuff::set to
	new arguments.
	(cwdstuff::init): Only call cwdstuff::set if it's not already
	initialized.  Add comment.  Drop third parameter in call to
	cwdstuff::set.
	(cwdstuff::set): Partially rewrite.  Add lots of comments to explain
	everything.  Drop "doit" since it's not used anymore.  Always create
	new handle to CWD if not in a virtual path.  Drop PEB locking when
	reading PEB values in init phase.  Check for accessibility to set
	correct error code.  Drop Vista workaround.  Never write back into PEB.
	Set Win32 CWD to \\?\PIPE\ on init.  Simplify creation of win32 path.
	Set new error member to a meaningful value.
	(cwdstuff::get_error_desc): New method to generate error message
	from cwd error code.
	* spawn.cc (spawn_guts): Call cwdstuff::get_error_desc to create
	more meaningful error message when not being able to start native
	Win32 app due to CWD restrictions.  When starting native Win32 app,
	lock cwd and use in calls to CreateProcessW/CreateProcessAsUserW.
2010-08-13 11:51:54 +00:00
Corinna Vinschen 601fbebdf5 * spawn.cc (spawn_guts): Reinstantiate a FIXME comment. 2010-06-29 10:37:23 +00:00
Corinna Vinschen e7daa3ed75 * exceptions.cc (dump_exception): Use %W instead of %s for printing
progname.
	* fork.cc (frok::parent): Fix typos in debug output.
	* spawn.cc (spawn_guts): Copy wide Win32 filename into _pinfo::progname,
	rather than native NT name.
2010-06-29 10:28:40 +00:00
Christopher Faylor d3258e063c * environ.cc (regopt): Change the first argument to wide char string.
(environ_init): Accommodate change to the first argument of regopt.
* exception.cc (open_stackdumpfile): Accommodate change to the type of progname
in _pinfo.
* external.cc (fillout_pinfo): Ditto.
* fhandler_process.cc (format_process_winexename): Ditto.
(format_process_stat): Ditto.
* fork.cc (fork::parent): Ditto.
* pinfo.cc (pinfo_basic::pinfo_basic): Call GetModuleFileNameW instead of
GetModuleFileName.
(pinfo::thisproc): Accommodate change to the type of progname in _pinfo.
(pinfo_init): Ditto.
* pinfo.h (_pinfo): Change the type of progname to a wide char array.
* registry.h (reg_key::get_int): Change the first argument from constant point
to pointer to constant.
(reg_key::get_string): Ditto.  Change the last argument likewise.
* registry.cc (reg_key::get_int): Accommodate change to the declaration.
(reg_key::get_string): Ditto.
* strace.cc (strace::hello): Accommodate change to the type of progname in
_pinfo.
(strace::vsprntf): Ditto.
2010-05-18 14:30:51 +00:00
Christopher Faylor 9b53b52a80 * spawn.cc (find_exec): Use the first detected errno when lookup fails. 2010-04-27 23:06:48 +00:00
Corinna Vinschen b3cbb06c9d * spawn.cc (find_exec): Enable finding paths in backslash notation,
especially for the exec[vl]p functions.

	* path.cc (symlink_info::check): Disable returning directories with
	suffix appended here.
2010-03-29 17:15:51 +00:00
Corinna Vinschen 27ac64346f * spawn.cc (spawn_guts): Only try to remove long path prefix from
runpath if runpath is not NULL.
2010-01-25 11:21:56 +00:00
Corinna Vinschen 6d63272b53 * exec.cc (execvp): Call find_exec with FE_NNF flag to enforce
a NULL return when executable isn't found in $PATH.  Convert NULL
	to "".
	(execvpe): Ditto.
	* spawn.cc (spawn_guts): Return with EFAULT if prog_arg is NULL.
	Return with ENOENT if prog_arg is empty string.  Add a comment.
2009-12-21 15:16:28 +00:00
Corinna Vinschen f16706de97 Throughout, replace hMainProc with GetCurrentProcess/NtCurrentProcess
according to context.  Throughout, replace hMainThread with
	GetCurrentThread/NtCurrentThread according to context.
	* dcrt0.cc (dll_crt0_0): Drop duplication of GetCurrentProcess to
	hMainProc.  Drop duplication of GetCurrentThread to hMainThread.
	* dtable.cc (dtable::stdio_init): Remove useless comment.
	* globals.cc (hMainProc): Remove.
	(hMainThread): Remove.
	* ntdll.h (NtCurrentProcess): Define.
	(NtCurrentThread: Define.
2009-12-18 20:32:04 +00:00
Corinna Vinschen b14f53a8ec Reintegrate socket duplication via WSADuplicateSocket/WSASocket.
* autoload.cc (WSADuplicateSocketW): Define.
	(WSASocketW): Define.
	* dtable.cc (dtable::release): Call dec_need_fixup_before if necessary.
	(dtable::fixup_before_fork): New function.
	(dtable::fixup_before_exec): New function.
	* dtable.h (class dtable): Add member cnt_need_fixup_before.  Add
	declarations for above new functions.
	(dtable::dec_need_fixup_before): New inline method.
	(dtable::inc_need_fixup_before): New inline method.
	(dtable::need_fixup_before): New inline method.
	* fhandler.h (fhandler_base::fixup_before_fork_exec): New virtual
	method.
	(fhandler_base::need_fixup_before): New virtual method.
	(class fhandler_socket): Add member prot_info_ptr.
	(fhandler_socket::init_fixup_before): Declare.
	(fhandler_socket::need_fixup_before): New inline method.
	(fhandler_socket::fixup_before_fork_exec): Declare.
	(fhandler_socket::fixup_after_exec): Declare.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
	prot_info_ptr to NULL.
	(fhandler_socket::~fhandler_socket): Free prot_info_ptr conditionally.
	(fhandler_socket::init_fixup_before): New method.
	(fhandler_socket::fixup_before_fork_exec): Ditto.
	(fhandler_socket::fixup_after_fork): Use WSASocketW to duplicate
	socket if necessary.
	(fhandler_socket::fixup_after_exec): New method.
	(fhandler_socket::dup): Use fixup_before_fork_exec/fixup_after_fork
	to duplicate socket if necessary.
	* fork.cc (frok::parent): Start child suspended if some fhandler
	needs fixup before fork.  If so, call dtable::fixup_before_fork after
	CreateProcess and resume child.
	* net.cc (fdsock): Try to find out if socket needs fixup before and
	initialize socket accordingly.  Add HUGE comment to explain what happens
	and why.
	* spawn.cc (spawn_guts): Start child suspended if some fhandler needs
	fixup before exec.  If so, call dtable::fixup_before_exec after
	CreateProcess.
2009-11-17 10:43:01 +00:00
Corinna Vinschen e807aacea9 * spawn.cc (dll_suffixes): Disable. Explain why.
(perhaps_suffix): Use stat_suffixes instead of dll_suffixes.
2009-11-05 09:59:18 +00:00
Corinna Vinschen b3f5fb3718 * spawn.cc (av::fixup): Treat non-readable, but executable files as
Cygwin executables.
2009-10-19 08:33:00 +00:00
Corinna Vinschen 0191627a26 * include/sys/cygwin.h: Add new cygwin_getinfo_type
CW_SET_EXTERNAL_TOKEN.
	Add new enum CW_TOKEN_IMPERSONATION, CW_TOKEN_RESTRICTED.
	* cygheap.h (cyguser): New flags ext_token_is_restricted,
	curr_token_is_restricted and setuid_to_restricted.
	* external.cc (cygwin_internal): Add CW_SET_EXTERNAL_TOKEN.
	* sec_auth.cc (set_imp_token): New function.
	(cygwin_set_impersonation_token): Call set_imp_token ().
	* security.h (set_imp_token): New prototype.
	* spawn.cc (spawn_guts): Use CreateProcessAsUserW if restricted token
	was enabled by setuid().  Do not create new window station in this case.
	* syscalls.cc (seteuid32): Add handling of restricted external tokens.
	Set HANDLE_FLAG_INHERIT for primary token.
	(setuid32): Set setuid_to_restricted flag.
	* uinfo.cc (uinfo_init): Do not reimpersonate if restricted token was
	enabled by setuid ().  Initialize user.*_restricted flags.
2009-10-13 10:23:31 +00:00
Eric Blake 3dbe243afa Fix faccessat(,0) and access() semantics.
* fhandler.h (fhandler_base::fhaccess): Add parameter.
* security.h (check_file_access, check_registry_access): Likewise.
* security.cc (check_file_access, check_registry_access)
(check_access): Implement new parameter.
* fhandler.cc (fhandler_base::fhaccess): Likewise.
(device_access_denied): Update caller.
* syscalls.cc (access, faccessat): Update callers.
* spawn.cc (find_exec, fixup): Likewise.
2009-09-25 13:44:45 +00:00
Corinna Vinschen 9043b49e63 * spawn.cc (av::fixup): Check shell scripts for executability only on
filesystems/mounts supporting real permissions.
2009-08-10 18:36:28 +00:00
Christopher Faylor fafbf75509 * cygheap_malloc.h: New file.
* cygheap.h: Remove stuff now included in cygheap_malloc.h and include that
file.  Make cygheap_init a standard c++ function.  Remove unneeded child_info
declaration.
* path.h: Include cygheap_malloc.h.  Remove extra cstrdup declaration.
(path_conv): Reorganize to group variables together.
(path_conv::path): Make const char *.
(path_conv::known_suffix): Ditto.
(path_conv::normalized_path): Ditto.
(path_conv::path_conv): Reorganize initializers to reflect new element
ordering.
(path_conv::get_win32): Change return value to const char *.
(path_conv::set_path): Move back here from spawn.cc.
(parh_conv::modifiable_path): New function.
* path.cc (path_conv::add_ext_from_sym): Accommodate const'ness of
known_suffixes.
(path_conv::set_normalized_path): Ditto for normalized_path.
(path_conv::check): Use modifiable_path whereever we need to modify the path
element.  Use set_path to set the path.
(path_conv::~path_conv): Accommodate new const'ness.
* spawn.cc (perhaps_suffix): Declare ext as const since that's what is being
returned.
(path_conv::set_path): Move back to path.h.
* winf.f (linebuf): Perform minor cleanup.
(linebuf::fromargv): Change second parameter to const.
* winf.cc (linebuf::fromargv): Ditto.
2009-08-01 19:52:46 +00:00
Christopher Faylor 8cc84a8ce3 * path.h (path_conv::set_path): Change return value.
* spawn.cc (path_conv::set_path): Return newly set value.
(find_exec): Set retval to newly set value when calling set_path.
2009-08-01 17:55:58 +00:00
Christopher Faylor a3a060b596 * spawn.cc (find_exec): Fix one more path where retval was not set. 2009-08-01 03:36:44 +00:00
Christopher Faylor 5f297dc330 * spawn.cc (find_exec): Stop relying on the ability to set retval to a fixed
path_conv buffer and set it on the fly instead.
2009-08-01 03:27:51 +00:00
Corinna Vinschen 0986989f6a * path.h (class path_conv): Convert path from char array to char *.
Initialize to NULL in constructors.  Drop normalized_path_size member.
	(path_conv::size): Remove.
	(path_conv::operator =): Always copy with sizeof path_conv.  Always
	duplicate path on cygheap.
	(path_conv::set_path): Move implementation to spawn.cc.
	* path.cc (path_conv::set_normalized_path): Always allocate
	normalized_path on cygheap.
	(path_conv::check): Don't work on path, rather allocate THIS_path in
	TLS and use it throughout.  When finished, allocate path on cygheap
	and copy over.  Defer tacking on extension after having copied path.
	* spawn.cc (path_conv::set_path): Implement here.
2009-07-30 08:56:57 +00:00
Christopher Faylor 01d8a2dfd6 * autoload.cc (SetParent): Add new import.
* fhandler.h (fhandler_console::create_invisible_console): Declare new
function.
(create_invisible_console_workaround): Ditto.
* fhandler_console.cc (fhandler_console::create_invisible_console): Define new
function.
(create_invisible_console_workaround): Ditto.  Add too much code to deal with
broken Windows 7.  Use a helper app to start an invisible console window.
(fhandler_console::need_invisible): Reorganize to use helper functions to
create invisible console.
* spawn.cc (spawn_guts): Avoid zeroing already zeroed fields in si.
2009-07-04 23:51:10 +00:00
Corinna Vinschen d6bb3f330d * spawn.cc (spawn_guts): Don't run additional check for Win32
incompatible CWD if newargv.fixup bailed out already.
	(av::fixup): Check shell scripts for executability.
2009-06-22 15:40:59 +00:00
Christopher Faylor 66eaf280ac * net.cc: Undefine NOERROR and DELETE to avoid compiler warnings.
* shared_info.h (CURR_SHARED_MAGIC): Update.
* spawn.cc (spawn_guts): Avoid copying one line command line argument if it
hasn't been filled out.
2009-04-05 04:23:50 +00:00
Christopher Faylor 99fe2b7866 Add DESTDIR functionality to Makefile.in's. 2009-02-24 02:11:14 +00:00
Christopher Faylor d95d8c5393 * include/sys/cygwin.h (CW_SETERRNO): Define.
* external.cc (CW_SETERRNO): Implement.
* include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 192 to reflect the
above change.
* path.cc (path_prefix_p): Treat X: as equivalent to x:.
* mkglobals_h: Remove unneeded #define.
* spawn.cc (spawn_guts): Avoid overly wordy initialization to zero.
2009-01-09 05:18:02 +00:00
Christopher Faylor 66a83f3eac Remove unneeded header files from source files throughout. Update copyrights
where appropriate.
* globals.cc: New file for generic global variables.
* mkglobals_h: New file to generate globals.h.
* mkstatic: New Script used to build a (currently non-working) static
libcygwin_s.a.
* Makefile.in: Add unused rule to build a non-working libcygwin_s.a.
(DLL_OFILES): Add globals.o.  Make all objects rely on globals.h.
(globals.h): New target.  Generate globals.h.
* cygtls.h: Honor new CYGTLS_HANDLE define to control when the HANDLE operator
is allowed in _cygtls.
* dcrt0.cc: Move most globals to globals.cc.
* init.cc: Ditto.
* environ.cc (strip_title_path): Remove now-unneeded extern.
* fhandler_serial.cc (fhandler_serial::open): Ditto.
* pinfo.cc: Ditto.
(commune_process): Ditto.
* shared.cc: Ditto.
* glob.cc: Ditto.
* strace.cc: Ditto.
* exceptions.cc: Define CYGTLS_HANDLE before including winsup.h.
* path.cc (stat_suffixes): Move here.
* security.h: Add forward class path_conv declaration.
* smallprint.cc (__small_vsprintf): Make a true c++ function.
(__small_sprintf): Ditto.
(small_printf): Ditto.
(console_printf): Ditto.
(__small_vswprintf): Ditto.
(__small_swprintf): Ditto.
* spawn.cc (spawn_guts): Remove _stdcall decoration in favor of regparm.
(hExeced): Move to globals.cc
* strfuncs.cc (current_codepage): Ditto.
(active_codepage): Ditto.
* sync.cc (lock_process::locker): Move here from dcrt0.cc.
* syscalls.cc (stat_suffixes): Move to path.cc.
* tty.cc (tty::create_master): Uncapitalize fatal warning for consistency.
* winsup.h: Include globals.h to declare most of the grab bag list of globals
which were previously defined here.
* mount.h: Move USER_* defines back to shared_info.h.
* speclib: Force temporary directory cleanup.
2009-01-03 05:12:22 +00:00
Christopher Faylor 025c1fac6e 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 17:21:04 +00:00
Christopher Faylor 7b9e380f03 * cygheap.cc (creturn): Reorganize to avoid a new compiler warning/error.
* dtable.cc (handle_to_fn): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
(fhandler_console::scroll_screen): Ditto.
(dev_console::set_color): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::write): Ditto.
(fhandler_dev_dsp::read): Ditto.
* fhandler_tape.cc (mtinfo_drive::get_status): Ditto.
* hookapi.cc (find_first_notloaded_dll): Ditto.
* mmap.cc (msync): Ditto.
* pipe.cc (pipesync::pipesync): Ditto.
* sec_acl.cc (getace): Ditto.
* sec_auth.cc (create_token): Ditto.
(lsaauth): Ditto.
* select.cc (peek_pipe): Ditto.
* spawn.cc (av::fixup): Ditto.
* syscalls.cc (popen): Ditto.
* tty.cc (tty::init_session): Ditto.
* uinfo.cc (pwdgrp::load): Ditto.
* fhandler.cc (fhandler_base::setup_overlapped): Ditto.
(fhandler_base::wait_overlapped): Rename second use of res variable to wres or
errors are not returned correctly.
* dcrt0.cc: Remove obsolete variable.
* dll_init.cc (release_upto): Fix typo involving incorrect use of '|'.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Avoid a compiler
warning regarding coercing type-punned variables.
(fhandler_base::fstat_by_name): Ditto.  fhandler_fifo.cc
(fhandler_fifo::open_nonserver): Fix = vs.  == typo.
(fhandler_fifo::wait): Add all conditions to switch statement to avoid a
compiler warning.
* fhandler_process.cc: Avoid unneeded initialization of variables to zero.
(fhandler_socket::listen): Add braces around initializer.
* flock.cc (inode_t::get_all_locks_list): Reorganize to avoid a compiler
warning.  Fix problem with EWOULDBLOCK error return.
* path.cc (GUID_shortcut): Use braces around struct initializer.
(cygwin_conv_path): Reorganize to avoid a compiler warning.
* random.cc (dummy): Mark variable as volatile to avoid a "used uninitialized"
warning.
* libc/getopt.c: Mark some variables as dllexport although gcc doesn't seem to
do the right thing with them.
* libc/minires-os-if.c (get_registry_dns_items): Coerce some function arguments
to avoid a compiler warning.
2008-09-11 04:34:24 +00:00
Corinna Vinschen 9fe98985b3 * spawn.cc (spawn_guts): Check constructed short pathname for being
a DOS device name and fall back to long path name, if so.
2008-07-31 14:41:19 +00:00
Corinna Vinschen 02151f07e6 * spawn.cc (spawn_guts): Fix previous patch for UNC paths. 2008-07-23 10:17:04 +00:00
Corinna Vinschen 19dc8ba9b2 * spawn.cc (spawn_guts): Remove long path prefix from win32 path
before calling CreateProcess if path length is < MAX_PATH.
2008-07-22 16:59:59 +00:00
Corinna Vinschen e2406d71aa Throughout drop allow_ntsec and allow_smbntsec handling.
* environ.cc (set_ntsec): Remove.
	(set_smbntsec): Remove.
	(known): Remove ntsec and smbntsec options.
	* external.cc (check_ntsec): Return true if no filename is given.
	* mount.cc (oopts): Add "acl" and "noacl" options.  Set MOUNT_NOACL
	flag accordingly.
	(fillout_mntent): Handle MOUNT_NOACL flag.
	* path.h (enum path_types): Add PATH_NOACL.
	* security.cc (allow_ntsec): Remove.
	(allow_smbntsec): Remove.
	* security.h (allow_ntsec): Drop declaration.
	(allow_smbntsec): Drop declaration.
	* include/sys/mount.h (MOUNT_NOACL): Define.
2008-07-14 20:22:03 +00:00
Christopher Faylor 7ba4aab9b6 * spawn.cc (spawn_guts): Reinstate call to fhandler_console::need_invisible
since it is required to prevent console flashing.
2008-06-17 15:38:17 +00:00
Corinna Vinschen 9cdaf8733f * fhandler.h (set_console_state_for_spawn): Drop declaration.
* fhandler_console.cc (set_console_state_for_spawn): Remove.
	(fhandler_console::open): Set console state last.  Don't set
	ENABLE_PROCESSED_INPUT flag.
	* spawn.cc (spawn_guts): Drop call to set_console_state_for_spawn.
2008-06-12 15:57:23 +00:00
Corinna Vinschen 7aefc1596d * dtable.cc (dtable::release): Drop fixup_before handling.
(dtable::fixup_before_fork): Remove.
	(dtable::fixup_before_exec): Remove.
	* dtable.h (class dtable): Remove cnt_need_fixup_before member.
	(dtable::dtable): Accommodate above change.
	(dtable::dec_need_fixup_before): Remove.
	(dtable::inc_need_fixup_before): Remove.
	(dtable::need_fixup_before): Remove.
	(dtable::fixup_before_exec): Remove declaration.
	(dtable::fixup_before_fork): Ditto.
	* fhandler.h (fhandler_base::fixup_before_fork_exec): Remove.
	(fhandler_base::need_fixup_before): Remove.
	* fork.cc (frok::parent): Drop fixup_before handling.
	* spawn.cc (spawn_guts): Ditto.
2008-04-30 09:51:38 +00:00
Corinna Vinschen 346cdb434e * dcrt0.cc (dll_crt0_0): Set SEM_NOGPFAULTERRORBOX error mode, too,
to accommodate Vista/Longhorn.
	* spawn.cc (spawn_guts): Move check for CREATE_SUSPENDED condition
	after the call to ch.set() since it depends on it.
2008-04-26 18:01:42 +00:00
Christopher Faylor b13e6864f5 Remove unneeded header files from source files throughout. 2008-04-07 18:45:59 +00:00
Christopher Faylor 93d606f60a * hookapi.cc (find_first_notloaded_dll): New function.
* pinfo.cc (status_exit): New function.  Issue message when dll not found.  Use
find_first_notloaded_dll to find a nonexistent dll.
(pinfo::maybe_set_exit_code_from_windows): Call status_exit when exit code >=
0xc0000000UL.
* sigproc.cc (child_info::proc_retry): Return exit code when
STATUS_DLL_NOT_FOUND.
* spawn.cc (spawn_guts): Minor cleanup.
* syscalls.cc (close_all_files): Don't actually close stderr filehandle.  Just
make it noninheritable.
* winsup.h (find_first_notloaded_dll): Declare new function.
* ntdll.h: Add several missing NTSTATUS defines.
2008-03-27 01:50:40 +00:00
Corinna Vinschen edab6053a2 * winsup.h (NT_MAX_PATH): Revert ill-advised change to 32767.
Accommodate change throughout.

	* cygwin.din (cygwin_conv_path): Export.
	(cygwin_conv_path_list): Export.
	(cygwin_create_path): Export.
	* dcrt0.cc (dll_crt0_1): Use cygwin_conv_path.
	* dtable.cc (handle_to_fn): Ditto.  Don't expect UNICODE_STRING being
	0-terminated.
	* environ.cc (env_plist_to_posix): New helper function.
	(env_plist_to_win32): Ditto.
	(env_path_to_posix): Ditto.
	(env_path_to_win32): Ditto.
	(return_MAX_PATH): Remove.
	(conv_envvars): Use new helper functions.  Drop removed members.
	(win_env::operator =): Accommodate removal of path length functions.
	(win_env::add_cache): Accommodate new env helper function API.
	(posify): Ditto.
	* environ.h (struct win_env): Ditto. Remove path length function
	pointers since they are unused.
	* path.cc (warn_msdos): Use cygwin_conv_path.
	(getfileattr): Use new tmp_pathbuf::u_get method.
	(fillout_mntent): Ditto.
	(symlink_info::check): Ditto.
	(path_conv::check): Use sizeof (WCHAR) instead of constant 2.
	(symlink_info::check_reparse_point): Ditto.
	(conv_path_list): Get max size of target string as argument.  Call
	cygwin_conv_path as helper function.
	(cygwin_conv_path): New function.
	(cygwin_create_path): New function.
	(cygwin_conv_to_win32_path): Just call cygwin_conv_path with size set
	to MAX_PATH.
	(cygwin_conv_to_full_win32_path): Ditto.
	(cygwin_conv_to_posix_path): Ditto.
	(cygwin_conv_to_full_posix_path): Ditto.
	(conv_path_list_buf_size): Add FIXME comment.
	(env_PATH_to_posix): Rename from env_win32_to_posix_path_list.
	Add size argument as required for env helper functions.
	(cygwin_win32_to_posix_path_list): Call conv_path_list with size set to
	MAX_PATH.
	(cygwin_posix_to_win32_path_list): Ditto.
	(cygwin_conv_path_list): New function.
	(cwdstuff::get): Fix length argument in call to sys_wcstombs.
	* spawn.cc (find_exec): Use cygwin_conv_path_list.
	* tls_pbuf.h (tmp_pathbuf::u_get: New method.
	* uinfo.cc (cygheap_user::ontherange): Allocate temporary path buffers
	using tmp_pathbuf.  Use cygwin_conv_path.
	* winf.cc (av::unshift): Use cygwin_conv_path.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/cygwin.h: Comment out old cygwin32_XXX API.
	Mark old path handling API as deprecated.
	(cygwin_conv_path_t): Typedef.  Define values.
	(cygwin_conv_path): Declare.
	(cygwin_create_path): Declare.
	(cygwin_conv_path_list): Declare.
2008-03-12 12:41:50 +00:00