projects
/
samtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mention ‘SAMtools’ in libbam-dev's description, to make it easier to find with apt...
[samtools.git]
/
knetfile.c
diff --git
a/knetfile.c
b/knetfile.c
index 994babb6a384e2757098bd6b042970a4dd54a801..af091465862c238aefeb3d0562b03f75320b6c1d 100644
(file)
--- a/
knetfile.c
+++ b/
knetfile.c
@@
-1,6
+1,7
@@
/* The MIT License
/* The MIT License
- Copyright (c) 2008 Genome Research Ltd (GRL).
+ Copyright (c) 2008 by Genome Research Ltd (GRL).
+ 2010 by Attractive Chaos <attractor@live.co.uk>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@
-23,11
+24,9
@@
SOFTWARE.
*/
SOFTWARE.
*/
-/* Contact: Heng Li <lh3@sanger.ac.uk> */
-
/* Probably I will not do socket programming in the next few years and
therefore I decide to heavily annotate this file, for Linux and
/* Probably I will not do socket programming in the next few years and
therefore I decide to heavily annotate this file, for Linux and
- Windows as well. -
lh3
*/
+ Windows as well. -
ac
*/
#include <time.h>
#include <stdio.h>
#include <time.h>
#include <stdio.h>
@@
-38,9
+37,7
@@
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
-#ifdef _WIN32
-#include <winsock.h>
-#else
+#ifndef _WIN32
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/socket.h>
@@
-92,7
+89,7
@@
static int socket_connect(const char *host, const char *port)
int on = 1, fd;
struct linger lng = { 0, 0 };
int on = 1, fd;
struct linger lng = { 0, 0 };
- struct addrinfo hints, *res;
+ struct addrinfo hints, *res
= 0
;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
@@
-519,7
+516,10
@@
off_t knet_read(knetFile *fp, void *buf, off_t len)
if (fp->type == KNF_TYPE_LOCAL) { // on Windows, the following block is necessary; not on UNIX
off_t rest = len, curr;
while (rest) {
if (fp->type == KNF_TYPE_LOCAL) { // on Windows, the following block is necessary; not on UNIX
off_t rest = len, curr;
while (rest) {
- curr = read(fp->fd, buf + l, rest);
+ do {
+ curr = read(fp->fd, buf + l, rest);
+ } while (curr < 0 && EINTR == errno);
+ if (curr < 0) return -1;
if (curr == 0) break;
l += curr; rest -= curr;
}
if (curr == 0) break;
l += curr; rest -= curr;
}
@@
-566,7
+566,7
@@
off_t knet_seek(knetFile *fp, int64_t off, int whence)
else if (whence==SEEK_SET)
fp->offset = off;
fp->is_ready = 0;
else if (whence==SEEK_SET)
fp->offset = off;
fp->is_ready = 0;
- return
fp->offset
;
+ return
0
;
}
errno = EINVAL;
fprintf(stderr,"[knet_seek] %s\n", strerror(errno));
}
errno = EINVAL;
fprintf(stderr,"[knet_seek] %s\n", strerror(errno));