This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Backwards?


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

Attachment: tty.patch
Description: Binary data

Attachment: ChangeLog.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]