From: Heng Li Date: Sun, 30 Jan 2011 03:59:20 +0000 (+0000) Subject: * avoid a segfault when network connect fails X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ac136c56a4a4d3ec250584eada27b60b6d721d8b;p=samtools.git * avoid a segfault when network connect fails * update INSTALL * fixed a bug in tview on big-endian by Nathan Weeks --- diff --git a/INSTALL b/INSTALL index f1cf7aa..37d84a9 100644 --- a/INSTALL +++ b/INSTALL @@ -1,29 +1,30 @@ System Requirements =================== -SAMtools depends on the zlib library . The latest -version 1.2.3 is preferred and with the latest version you can compile -razip and use it to compress a FASTA file. SAMtools' faidx is able to -index a razip-compressed FASTA file to save diskspace. Older zlib also -works with SAMtools, but razip cannot be compiled. +SAMtools depends on the zlib library . Version 1.2.3+ is +preferred and with 1.2.3+ you can compile razip and use it to compress a FASTA +file. SAMtools' faidx is able to index a razip-compressed FASTA file to save +diskspace. Older zlib also works with SAMtools, but razip cannot be compiled. The text-based viewer (tview) requires the GNU ncurses library -, which comes with Mac OS X and -most of the modern Linux/Unix distributions. If you do not have this -library installed, you can still compile the rest of SAMtools by -manually modifying one line in Makefile. +, which comes with Mac OS X and most of +the modern Linux/Unix distributions. If you do not have this library installed, +you can still compile the rest of SAMtools by manually changing: +`-D_CURSES_LIB=1' to `-D_CURSES_LIB=0' at the line starting with `DFLAGS=', and +comment out the line starting with `LIBCURSES='. Compilation =========== -Type `make' to compile samtools. If you have zlib >= 1.2.2.1, you can -compile razip with `make razip'. +Type `make' to compile samtools. If you have zlib >= 1.2.2.1, you can compile +razip with `make razip'. Installation ============ -Simply copy `samtools' and other executables/scripts in `misc' to a -location you want (e.g. a directory in your $PATH). No further -configurations are required. +Copy `samtools', `bcftools/bcftools' and other executables/scripts in `misc' to +a location you want (e.g. a directory in your $PATH). You may also copy +`samtools.1' and `bcftools/bcftools.1' to a directory in your $MANPATH such +that the `man' command may find the manual. diff --git a/bam_tview.c b/bam_tview.c index e48afa7..bf01e15 100644 --- a/bam_tview.c +++ b/bam_tview.c @@ -183,12 +183,12 @@ tview_t *tv_init(const char *fn, const char *fn_fa) { tview_t *tv = (tview_t*)calloc(1, sizeof(tview_t)); tv->is_dot = 1; - tv->idx = bam_index_load(fn); - if (tv->idx == 0) exit(1); tv->fp = bam_open(fn, "r"); bgzf_set_cache_size(tv->fp, 8 * 1024 *1024); assert(tv->fp); tv->header = bam_header_read(tv->fp); + tv->idx = bam_index_load(fn); + if (tv->idx == 0) exit(1); tv->lplbuf = bam_lplbuf_init(tv_pl_func, tv); if (fn_fa) tv->fai = fai_load(fn_fa); tv->bmc = bam_maqcns_init(); diff --git a/knetfile.c b/knetfile.c index 1e2c042..af09146 100644 --- a/knetfile.c +++ b/knetfile.c @@ -1,6 +1,7 @@ /* The MIT License - Copyright (c) 2008 Genome Research Ltd (GRL). + Copyright (c) 2008 by Genome Research Ltd (GRL). + 2010 by Attractive Chaos 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. */ -/* Contact: Heng Li */ - /* 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 #include @@ -90,7 +89,7 @@ static int socket_connect(const char *host, const char *port) 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;