]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Remove virPipeReadUntilEOF
authorPeter Krempa <pkrempa@redhat.com>
Mon, 1 Apr 2019 16:35:15 +0000 (18:35 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Apr 2019 14:51:02 +0000 (16:51 +0200)
Unused since 3c269b51a6f03a1a678e8d

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libvirt_private.syms
src/util/virutil.c
src/util/virutil.h

index 1f637bebd700eb9a97999a36cf3bf0b8935168ca..4a312218a26a1a0199f6c3b1aba7d1ae3b7c854d 100644 (file)
@@ -3226,7 +3226,6 @@ virMemoryMaxValue;
 virParseNumber;
 virParseOwnershipIds;
 virParseVersionString;
-virPipeReadUntilEOF;
 virScaleInteger;
 virSetBlocking;
 virSetCloseExec;
index 0d58f1ee57b8a6fc05f44b396835f014dd6df873..c0acf59831323142434130a599740e0699234b05 100644 (file)
@@ -191,88 +191,6 @@ int virSetSockReuseAddr(int fd, bool fatal)
 }
 #endif
 
-int
-virPipeReadUntilEOF(int outfd, int errfd,
-                    char **outbuf, char **errbuf) {
-
-    struct pollfd fds[2];
-    size_t i;
-    bool finished[2];
-
-    fds[0].fd = outfd;
-    fds[0].events = POLLIN;
-    fds[0].revents = 0;
-    finished[0] = false;
-    fds[1].fd = errfd;
-    fds[1].events = POLLIN;
-    fds[1].revents = 0;
-    finished[1] = false;
-
-    while (!(finished[0] && finished[1])) {
-
-        if (poll(fds, ARRAY_CARDINALITY(fds), -1) < 0) {
-            if ((errno == EAGAIN) || (errno == EINTR))
-                continue;
-            goto pollerr;
-        }
-
-        for (i = 0; i < ARRAY_CARDINALITY(fds); ++i) {
-            char data[1024], **buf;
-            int got, size;
-
-            if (!(fds[i].revents))
-                continue;
-            else if (fds[i].revents & POLLHUP)
-                finished[i] = true;
-
-            if (!(fds[i].revents & POLLIN)) {
-                if (fds[i].revents & POLLHUP)
-                    continue;
-
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               "%s", _("Unknown poll response."));
-                goto error;
-            }
-
-            got = read(fds[i].fd, data, sizeof(data));
-
-            if (got == sizeof(data))
-                finished[i] = false;
-
-            if (got == 0) {
-                finished[i] = true;
-                continue;
-            }
-            if (got < 0) {
-                if (errno == EINTR)
-                    continue;
-                if (errno == EAGAIN)
-                    break;
-                goto pollerr;
-            }
-
-            buf = ((fds[i].fd == outfd) ? outbuf : errbuf);
-            size = (*buf ? strlen(*buf) : 0);
-            if (VIR_REALLOC_N(*buf, size+got+1) < 0)
-                goto error;
-            memmove(*buf+size, data, got);
-            (*buf)[size+got] = '\0';
-        }
-        continue;
-
-    pollerr:
-        virReportSystemError(errno,
-                             "%s", _("poll error"));
-        goto error;
-    }
-
-    return 0;
-
- error:
-    VIR_FREE(*outbuf);
-    VIR_FREE(*errbuf);
-    return -1;
-}
 
 /* Convert C from hexadecimal character to integer.  */
 int
index f8d8d85d2793bfde8cef8d4304dbc32fda0fee98..a80e28b670952f1e9c9e98bd2394705cf3979c6a 100644 (file)
@@ -41,9 +41,6 @@ int virSetInherit(int fd, bool inherit) ATTRIBUTE_RETURN_CHECK;
 int virSetCloseExec(int fd) ATTRIBUTE_RETURN_CHECK;
 int virSetSockReuseAddr(int fd, bool fatal) ATTRIBUTE_RETURN_CHECK;
 
-int virPipeReadUntilEOF(int outfd, int errfd,
-                        char **outbuf, char **errbuf);
-
 int virSetUIDGID(uid_t uid, gid_t gid, gid_t *groups, int ngroups);
 int virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups,
                          unsigned long long capBits,