From 4bd34b4966f59ce109406754eae7a6fd473837b6 Mon Sep 17 00:00:00 2001
From: Philip Kaufmann <phil.kaufmann@t-online.de>
Date: Wed, 5 Sep 2012 22:20:26 +0200
Subject: [PATCH 1/2] replace 2x WSAGetLastError() with 1x WSAGetLastError()
 call

---
 src/net.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/net.cpp b/src/net.cpp
index 76e44a6cf..11bade6bb 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -823,8 +823,9 @@ void ThreadSocketHandler2(void* parg)
 
             if (hSocket == INVALID_SOCKET)
             {
-                if (WSAGetLastError() != WSAEWOULDBLOCK)
-                    printf("socket error accept failed: %d\n", WSAGetLastError());
+                int nErr = WSAGetLastError();
+                if (nErr != WSAEWOULDBLOCK)
+                    printf("socket error accept failed: %d\n", nErr);
             }
             else if (nInbound >= GetArg("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS)
             {

From 4dc89fa8755a512953d8588e1d706ae52c2eb35e Mon Sep 17 00:00:00 2001
From: Gavin Andresen <gavinandresen@gmail.com>
Date: Thu, 6 Sep 2012 15:51:16 -0400
Subject: [PATCH 2/2] Build doc updates

---
 contrib/gitian-descriptors/README | 31 +++++++++++++++++++++++++++++++
 doc/release-process.txt           | 10 +++++-----
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/contrib/gitian-descriptors/README b/contrib/gitian-descriptors/README
index 8a304eb34..8f272b009 100644
--- a/contrib/gitian-descriptors/README
+++ b/contrib/gitian-descriptors/README
@@ -53,3 +53,34 @@ Once you've got the right hardware and software:
 
     # Build Win32 release:
     ./bin/gbuild --commit bitcoin=HEAD ../bitcoin/contrib/gitian-descriptors/gitian-win32.yml
+
+---------------------
+
+gitian-builder now also supports building using LXC. See
+  https://help.ubuntu.com/12.04/serverguide/lxc.html
+... for how to get LXC up and running under Ubuntu.
+
+If your main machine is a 64-bit Mac or PC with a few gigabytes of memory
+and at least 10 gigabytes of free disk space, you can gitian-build using
+LXC running inside a virtual machine.
+
+Here's a description of Gavin's setup on OSX 10.6:
+
+1. Download and install VirtualBox from https://www.virtualbox.org/
+
+2. Download the 64-bit Ubuntu Desktop 12.04 LTS .iso CD image from
+  http://www.ubuntu.com/
+
+3. Run VirtualBox and create a new virtual machine, using the
+  Ubuntu .iso (see the VirtualBox documentation for details).
+  Create it with at least 2 gigabytes of memory and a disk
+  that is at least 20 gigabytes big.
+
+4. Inside the running Ubuntu desktop, install:
+  sudo apt-get install debootstrap lxc ruby apache2 git apt-cacher-ng python-vm-builder
+
+5. Still inside Ubuntu, tell gitian-builder to use LXC, then follow the "Once you've got the right
+  hardware and software" instructions above:
+  export USE_LXC=1
+  git clone git://github.com/bitcoin/bitcoin.git
+  ... etc
diff --git a/doc/release-process.txt b/doc/release-process.txt
index 59488a7bf..b31b0ab54 100644
--- a/doc/release-process.txt
+++ b/doc/release-process.txt
@@ -21,7 +21,7 @@
    export VERSION=0.5.1
    cd ./gitian-builder
 
-  * Fetch and build inputs:
+  * Fetch and build inputs: (first time, or when dependency versions change)
    mkdir -p inputs; cd inputs/
    wget 'http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.6.tar.gz' -O miniupnpc-1.6.tar.gz
    wget 'http://www.openssl.org/source/openssl-1.0.1b.tar.gz'
@@ -29,15 +29,15 @@
    wget 'http://zlib.net/zlib-1.2.6.tar.gz'
    wget 'ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.9.tar.gz'
    wget 'http://fukuchi.org/works/qrencode/qrencode-3.2.0.tar.bz2'
-   wget 'http://downloads.sourceforge.net/project/boost/boost/1.47.0/boost_1_47_0.tar.bz2'
+   wget 'http://downloads.sourceforge.net/project/boost/boost/1.50.0/boost_1_50_0.tar.bz2'
    wget 'http://download.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz'
    cd ..
    ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/boost-win32.yml
-   cp build/out/boost-win32-1.47.0-gitian.zip inputs/
+   mv build/out/boost-win32-1.50.0-gitian2.zip inputs/
    ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/qt-win32.yml
-   cp build/out/qt-win32-4.7.4-gitian.zip inputs/
+   mv build/out/qt-win32-4.7.4-gitian.zip inputs/
    ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/deps-win32.yml
-   cp build/out/bitcoin-deps-0.0.3.zip inputs/
+   mv build/out/bitcoin-deps-0.0.3.zip inputs/
 
   * Build bitcoind and bitcoin-qt on Linux32, Linux64, and Win32:
    ./bin/gbuild --commit bitcoin=v${VERSION} ../bitcoin/contrib/gitian-descriptors/gitian.yml