[SSSD] [PATCH] Properly handle read() and write() throughout the SSSD

Stephen Gallagher sgallagh at redhat.com
Wed Jun 9 13:18:23 UTC 2010


On 06/09/2010 09:04 AM, Jakub Hrozek wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 06/09/2010 02:02 PM, Stephen Gallagher wrote:
>> Thanks, new patch attached.
>>
>
> One more comment, in get_uid_from_pid():
>
> +            }
> +            DEBUG(1, ("read failed [%d][%s].\n", errno, +strerror(errno)));
> +            return errno;
> +        }
>
> I think you should save errno somewhere, otherwise it will be
> overwritten by printf() in the DEBUG() call.
>

I'm attaching a second patch to handle this, as errno is misused 
throughout that entire file. This patch applies atop the read/write patch.

> Otherwise looks OK, although I'm wondering whether it makes sense to
> have some kind of macro for loops around read() or write().

It wasn't worth writing a macro because we handle the loops differently 
in different places. In some places we exit back to the mainloop and 
wait for the tevent_fd handler to call us again, in other places we loop 
tightly, and in yet other places we are copying data from a read buffer 
into a write buffer.

-- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-misuse-of-errno-in-find_uid.c.patch
Type: text/x-patch
Size: 4214 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20100609/867d1e48/attachment.bin>


More information about the sssd-devel mailing list