From 06247775aa9c49ffce72827921eb45e2d04c6aa1 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 8 Jun 2010 15:47:34 -0400 Subject: Properly handle read() and write() throughout the SSSD We need to guarantee at all times that reads and writes complete successfully. This means that they must be checked for returning EINTR and EAGAIN, and all writes must be wrapped in a loop to ensure that they do not truncate their output. --- src/krb5_plugin/sssd_krb5_locator_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/krb5_plugin') diff --git a/src/krb5_plugin/sssd_krb5_locator_plugin.c b/src/krb5_plugin/sssd_krb5_locator_plugin.c index dfc9c197..70479efd 100644 --- a/src/krb5_plugin/sssd_krb5_locator_plugin.c +++ b/src/krb5_plugin/sssd_krb5_locator_plugin.c @@ -133,7 +133,7 @@ static int get_krb5info(const char *realm, struct sssd_ctx *ctx, memset(buf, 0, BUFSIZE+1); while (len != 0 && (ret = read(fd, p, len)) != 0) { if (ret == -1) { - if (errno == EINTR) continue; + if (errno == EINTR || errno == EAGAIN) continue; PLUGIN_DEBUG(("read failed [%d][%s].\n", errno, strerror(errno))); close(fd); goto done; -- cgit