Backwards?
Conrad Scott
Conrad.Scott@dsl.pipex.com
Wed Jul 3 07:23:00 GMT 2002
Yesterday the following fragment of code from tty.cc confused me
because it used small_print rather than system_printf (speedily fixed
by Chris). Now I'm confused because I don't understand the logic:
if (wincap.has_security ()
&& cygserver_running == CYGSERVER_OK
&& (SetKernelObjectSecurity (hMainProc,
ACL_SECURITY_INFORMATION,
get_null_sd ()) == FALSE))
small_printf ("Can't set process security, %E");
The call to SetKernelObjectSecurity was in the file before the
cygserver changes were added, i.e. the code used to be (before the
first cygwin_daemon merge):
if ((iswinnt) &&
(SetKernelObjectSecurity (hMainProc,
DACL_SECURITY_INFORMATION,
get_null_sd ()) == FALSE))
small_printf ("Can't set process security, %E");
On that basis, shouldn't the test for cygserver be reversed:
if (... && cygserver != CYGSERVER_OK && ...)
i.e. if cygserver isn't running, act as before?
I don't understand quite this code is trying to achieve or why but,
assuming it's wrong, I've attached a patch to reverse the test. I've
checked this on the cygwin_daemon branch, both with and without
cygserver running, and can see no difference (this is with both
processes running as the same user tho').
If someone could confirm / deny / explain this or even just wave their
hands around a bit and waffle, it would make me happier :-)
// Conrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tty.patch
Type: application/octet-stream
Size: 667 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20020703/8a37f287/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ChangeLog.txt
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20020703/8a37f287/attachment.txt>
More information about the Cygwin-patches
mailing list