$OpenBSD: patch-src_command_network_cc,v 1.1 2011/12/01 17:10:40 dcoppa Exp $

Unlink the target filename of 'network.scgi.open_local' before
opening (upstream git commit 5f21e207c3ead9373d1374e36fb78fb9741b32af)

--- src/command_network.cc.orig	Tue Jun 21 08:46:48 2011
+++ src/command_network.cc	Thu Oct 20 12:33:04 2011
@@ -39,6 +39,7 @@
 #include <functional>
 #include <fstream>
 #include <cstdio>
+#include <unistd.h>
 #include <rak/address_info.h>
 #include <rak/path.h>
 #include <torrent/connection_manager.h>
@@ -350,6 +351,7 @@ apply_scgi(const std::string& arg, int type) {
     int port, err;
     char dummy;
     char address[1024];
+    std::string path;
 
     switch (type) {
     case 1:
@@ -381,7 +383,10 @@ apply_scgi(const std::string& arg, int type) {
 
     case 2:
     default:
-      scgi->open_named(rak::path_expand(arg));
+      path = rak::path_expand(arg);
+
+      unlink(path.c_str());
+      scgi->open_named(path);
       break;
     }
 
