summaryrefslogtreecommitdiffstats
path: root/src/afb-hreq.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-04-07 11:53:43 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-04-07 11:53:43 +0200
commit94a5b505f7ef7760fcfa7b824ee49758eb63a9e8 (patch)
treed16ce96ae81e08d1b157461f1e168c3ee00f7f40 /src/afb-hreq.c
parentfc19b7d7974f9c64dffc40e180464d595a9805cd (diff)
fix file posting
Change-Id: If7e0aa3122af3a308a8441b518021f8a5cbe9473 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hreq.c')
-rw-r--r--src/afb-hreq.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/afb-hreq.c b/src/afb-hreq.c
index aff204d9..5ac45843 100644
--- a/src/afb-hreq.c
+++ b/src/afb-hreq.c
@@ -438,13 +438,15 @@ static int opentempfile(char **path)
int fd;
char *fname;
- fname = strdup("XXXXXX");
+ fname = strdup("XXXXXX"); /* TODO improve the path */
if (fname == NULL)
return -1;
- fd = mkostemp(fname, O_CLOEXEC);
+ fd = mkostemp(fname, O_CLOEXEC|O_WRONLY);
if (fd < 0)
free(fname);
+ else
+ *path = fname;
return fd;
}
@@ -454,6 +456,7 @@ int afb_hreq_post_add_file(struct afb_hreq *hreq, const char *key, const char *f
ssize_t sz;
struct hreq_data *hdat = get_data(hreq, key, 1);
+fprintf(stderr, "%s=%s %s=%s %s\n",key,hdat->key,file,hdat->value,hdat->path);
if (hdat->value == NULL) {
hdat->value = strdup(file);
if (hdat->value == NULL)