Question:
I found multiple read/write calls in libselinux have no EINTR check.
Do we need to apply the same scheme to all of them (cleanup read/write 
problems)?

---
 src/booleans.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/booleans.c b/src/booleans.c
index 60bf963..8935d51 100644
--- a/src/booleans.c
+++ b/src/booleans.c
@@ -108,7 +108,9 @@ static int get_bool_value(const char *name, char **buf)
        if (fd < 0)
                goto out;
 
-       len = read(fd, *buf, STRBUF_SIZE);
+       do {
+          len = read(fd, *buf, STRBUF_SIZE);
+       } while (len < 0 && errno == EINTR);
        close(fd);
        if (len != STRBUF_SIZE)
                goto out;
@@ -190,7 +192,9 @@ int security_set_boolean(const char *name, int value)
                buf[0] = '0';
        buf[1] = '\0';
 
-       ret = write(fd, buf, 2);
+       do {
+           ret = write(fd, buf, 2);
+       } while (ret < 0 && errno == EINTR);
        close(fd);
       out:
        free(fname);
@@ -221,7 +225,9 @@ int security_commit_booleans(void)
        buf[0] = '1';
        buf[1] = '\0';
 
-       ret = write(fd, buf, 2);
+       do {
+           ret = write(fd, buf, 2);
+       } while (ret < 0 && errno == EINTR);
        close(fd);
 
        if (ret > 0)
-- 
1.7.9.5


--
This message was distributed to subscribers of the seandroid-list mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe seandroid-list" without quotes as the message.

Reply via email to