summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorewt <devnull@localhost>1996-10-15 03:15:14 +0000
committerewt <devnull@localhost>1996-10-15 03:15:14 +0000
commit22f79c11fae52db656a3f17d818f899a0c9a8533 (patch)
treeac34dabad57cb5d3a19ec41c2f3b4fc81c6e11da
parent5d52779a8ea9a07d105910ec083cf61817f54f40 (diff)
downloadrpm-22f79c11fae52db656a3f17d818f899a0c9a8533.tar.gz
rpm-22f79c11fae52db656a3f17d818f899a0c9a8533.tar.bz2
rpm-22f79c11fae52db656a3f17d818f899a0c9a8533.zip
moved timedRead() to tread.c
CVS patchset: 1095 CVS date: 1996/10/15 03:15:14
-rw-r--r--lib/header.c37
1 files changed, 1 insertions, 36 deletions
diff --git a/lib/header.c b/lib/header.c
index b000d79fe..b81e9a3fb 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -7,21 +7,16 @@
/* Data read from file descriptors is expected to be in */
/* network byte order and is converted on the fly to host order. */
-#ifdef HAVE_ASM_BYTEORDER_H
-# include <asm/byteorder.h>
-#endif
-
#include <stdlib.h>
#include <ctype.h>
#include <malloc.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
-#include <sys/time.h>
-#include <sys/types.h>
#include "header.h"
#include "rpmlib.h" /* necessary only for dumpHeader() */
+#include "tread.h"
#define INDEX_MALLOC_SIZE 8
#define DATA_MALLOC_SIZE 1024
@@ -281,36 +276,6 @@ static void *dataHostToNetwork(Header h)
return data;
}
-int timedRead(int fd, void * bufptr, int length) {
- int bytesRead;
- int total = 0;
- char * buf = bufptr;
- struct fd_set readSet;
- struct timeval tv;
-
- while (total < length) {
- FD_ZERO(&readSet);
- FD_SET(fd, &readSet);
-
- tv.tv_sec = 5; /* FIXME: this should be configurable */
- tv.tv_usec = 0;
-
- if (select(fd + 1, &readSet, NULL, NULL, &tv) != 1)
- return total;
-
- bytesRead = read(fd, buf + total, length - total);
-
- if (bytesRead < 0)
- return bytesRead;
- else if (bytesRead == 0)
- return total;
-
- total += bytesRead;
- }
-
- return length;
-}
-
Header readHeader(int fd, int magicp)
{
int_32 il, dl;