From 8009c499c5057b532759387353734609f1569e55 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 9 Feb 2014 14:16:47 +0800 Subject: [PATCH] fix bug in run_csd_script() run_csd_script() uses proxy_write() to write the CSD script to file. From commit 433132b90473538fa46fb6934ef8f7b7f36447b5 "Use send() and recv() for proxy communication (for MinGW's benefit)" proxy_write() replaces write() with send(), incompatible with run_csd_script(). Got error: Failed to write temporary CSD script file: Socket operation on non-socket Replace proxy_write() with write() directly in run_csd_script(). Run only a simple check that write() really writes all the buffer. Signed-off-by: Antonio Borneo --- http.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/http.c b/http.c index 5d58846..dc77918 100644 --- a/http.c +++ b/http.c @@ -563,12 +563,13 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int bufle return err; } - ret = proxy_write(vpninfo, fd, (void *)buf, buflen); - if (ret) { + ret = write(fd, (void *)buf, buflen); + if (ret != buflen) { + int err = -errno; vpn_progress(vpninfo, PRG_ERR, _("Failed to write temporary CSD script file: %s\n"), - strerror(-ret)); - return ret; + strerror(errno)); + return err; } fchmod(fd, 0755); close(fd); -- 1.7.3.4