Skip to content

Commit

Permalink
Use the somewhat misnamed proxy_write() function to write the CSD script
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Piątyszek <ediap@users.sourceforge.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Adam Piątyszek authored and David Woodhouse committed Feb 22, 2010
1 parent d57b9e3 commit cc09a51
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions http.c
Expand Up @@ -40,6 +40,8 @@

#include "openconnect.h"

static int proxy_write(int fd, unsigned char *buf, size_t len);

#define MAX_BUF_LEN 131072
/*
* We didn't really want to have to do this for ourselves -- one might have
Expand Down Expand Up @@ -344,7 +346,7 @@ static int fetch_config(struct openconnect_info *vpninfo, char *fu, char *bu,
static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int buflen)
{
char fname[16];
int fd;
int fd, ret;

if (!vpninfo->uid_csd_given) {
vpninfo->progress(vpninfo, PRG_ERR, "Error: You are trying to "
Expand All @@ -366,7 +368,13 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf, int bufle
strerror(errno));
return err;
}
write(fd, buf, buflen);

ret = proxy_write(fd, (void *)buf, buflen);
if (ret) {
vpninfo->progress(vpninfo, PRG_ERR, "Failed to write temporary CSD script file: %s\n",
strerror(ret));
return ret;
}
fchmod(fd, 0755);
close(fd);

Expand Down

0 comments on commit cc09a51

Please sign in to comment.