From 0298d88167daa0bb63b2f539272bde06e51ba11c Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 17 May 2008 10:39:10 +0300 Subject: [PATCH] 1008: Save errno if open() fails in file upload. --- src/protocol/file/cgi.c | 5 +++-- src/protocol/http/http.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/protocol/file/cgi.c b/src/protocol/file/cgi.c index f06bb16e..ac163350 100644 --- a/src/protocol/file/cgi.c +++ b/src/protocol/file/cgi.c @@ -138,9 +138,10 @@ send_files(struct socket *socket) conn->post_fd = open(file + 1, O_RDONLY); *end = FILE_CHAR; if (conn->post_fd < 0) { + int errno_from_open = errno; + done_string(&data); - /* FIXME: proper error code */ - abort_connection(conn, S_OUT_OF_MEM); + abort_connection(conn, -errno_from_open); return; } http->post_data = end + 1; diff --git a/src/protocol/http/http.c b/src/protocol/http/http.c index 7eb979e4..3dcf83b8 100644 --- a/src/protocol/http/http.c +++ b/src/protocol/http/http.c @@ -669,9 +669,10 @@ send_files(struct socket *socket) conn->post_fd = open(file + 1, O_RDONLY); *end = FILE_CHAR; if (conn->post_fd < 0) { + int errno_from_open = errno; + done_string(&data); - /* FIXME: proper error code */ - http_end_request(conn, S_OUT_OF_MEM, 0); + http_end_request(conn, -errno_from_open, 0); return; } http->post_data = end + 1;