summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-12-23 00:12:23 +0000
committerJeremy Katz <katzj@redhat.com>2003-12-23 00:12:23 +0000
commitb0f9f247a9f101d41bbb8c7aac91ea8e9896d124 (patch)
treea846b52cccacada5735b158699f49c796a0f8f6e /isys
parente1efb3ddac57f6bfd47fe7b5f1d947141c717c73 (diff)
downloadanaconda-b0f9f247a9f101d41bbb8c7aac91ea8e9896d124.tar.gz
anaconda-b0f9f247a9f101d41bbb8c7aac91ea8e9896d124.tar.xz
anaconda-b0f9f247a9f101d41bbb8c7aac91ea8e9896d124.zip
readfd is used here
Diffstat (limited to 'isys')
-rw-r--r--isys/vio.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/isys/vio.c b/isys/vio.c
index c03896acd..dc1c4c528 100644
--- a/isys/vio.c
+++ b/isys/vio.c
@@ -17,6 +17,38 @@
#include <kudzu/kudzu.h>
+static int readFD (int fd, char **buf)
+{
+ char *p;
+ size_t size = 4096;
+ int s, filesize;
+
+ *buf = malloc (size);
+ if (*buf == 0)
+ return -1;
+
+ filesize = 0;
+ do {
+ p = &(*buf) [filesize];
+ s = read (fd, p, 4096);
+ if (s < 0)
+ break;
+ filesize += s;
+ if (s != 4096)
+ break;
+ size += 4096;
+ *buf = realloc (*buf, size);
+ } while (1);
+
+ if (filesize == 0 && s < 0) {
+ free (*buf);
+ *buf = NULL;
+ return -1;
+ }
+
+ return filesize;
+}
+
int isVioConsole(void) {
#if !defined(__powerpc__)
return 0;