aboutsummaryrefslogtreecommitdiffhomepage
path: root/mpaste.go
diff options
context:
space:
mode:
Diffstat (limited to 'mpaste.go')
-rw-r--r--mpaste.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/mpaste.go b/mpaste.go
index eec6a20..ade4b8e 100644
--- a/mpaste.go
+++ b/mpaste.go
@@ -178,6 +178,7 @@ func endpoint(w http.ResponseWriter, r *http.Request) {
}
mutex.Lock()
+ defer mutex.Unlock()
fname := file_prefix + strconv.Itoa(counter)
nfile, err := os.Create(fname)
@@ -198,7 +199,6 @@ func endpoint(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, domain+"/%d\n", counter)
counter++
- mutex.Unlock()
default:
WRITE_HEADER(http.StatusMethodNotAllowed, "Only GET and POST requests are supported")
}
@@ -233,6 +233,10 @@ func main() {
file_prefix += "/"
}
+ if counter_file == "" {
+ counter_file = "counter"
+ }
+
if index_file == "" {
index_file = "index.html"
}