[Spice-devel] [spice-xpi 4/5] Add SpiceControllerWin class

Marc-André Lureau mlureau at redhat.com
Mon Mar 25 05:06:27 PDT 2013



----- Mensaje original -----
> >  In general, returning true on success is easier to read.
> 
> This mimics the return value of connect(2), I'd prefer to keep that
> (at
> least in that patch, can be improved as a separate cleanup as this
> needs
> changes in SpiceController and SpiceControllerUnix as well).
> 
> > > +//checks whether the handle owner is the current user.
> > > +static bool is_same_user(HANDLE handle)
> > > +{
> > > +    PSECURITY_DESCRIPTOR psec_desc_handle = NULL;
> > > +    PSECURITY_DESCRIPTOR psec_desc_user = NULL;
> > > +    PSID psid_handle;
> > > +    PSID psid_user;
> > > +    bool ret;
> > > +
> > > +    ret = !get_sid(handle, &psid_handle, &psec_desc_handle) &&
> > > +          !get_sid(GetCurrentProcess(), &psid_user,
> > > &psec_desc_user) &&
> > > +          EqualSid(psid_handle, psid_user);
> > 
> > That would make this easier to read.
> 
> 'That' ? Sorry didn't get what you mean here.

the line above would be easier to read without the mix usage of ! and not-!, ymmv.

> g_return pre-condition? Do you mean this:
> 
> hClientPipe =
> g_win32_output_stream_get_handle(G_WIN32_OUTPUT_STREAM(m_pipe));
> g_return_if_fail(hClientPipe != INVALID_HANDLE_VALUE);

Yes


More information about the Spice-devel mailing list