diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-05-09 10:47:18 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-05-09 10:47:18 +0000 |
commit | 2184438b2d088ad0ffb54a763b045c0361b18a10 (patch) | |
tree | 367984335bd634e39193faac2356b18b6490076c /src/examples/demo.c | |
parent | f35fdf4b7c6f09557a6ac72e3550bcdbf6936f47 (diff) | |
download | libmicrohttpd-2184438b2d088ad0ffb54a763b045c0361b18a10.tar.gz libmicrohttpd-2184438b2d088ad0ffb54a763b045c0361b18a10.zip |
-bugfixes
Diffstat (limited to 'src/examples/demo.c')
-rw-r--r-- | src/examples/demo.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/examples/demo.c b/src/examples/demo.c index 62aabfa1..8b836a0c 100644 --- a/src/examples/demo.c +++ b/src/examples/demo.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <dirent.h> | 37 | #include <dirent.h> |
38 | #include <magic.h> | 38 | #include <magic.h> |
39 | #include <limits.h> | 39 | #include <limits.h> |
40 | #include <ctype.h> | ||
40 | 41 | ||
41 | /** | 42 | /** |
42 | * Number of threads to run in the thread pool. Should (roughly) match | 43 | * Number of threads to run in the thread pool. Should (roughly) match |
@@ -280,7 +281,7 @@ list_directory (struct ResponseDataContext *rdc, | |||
280 | rdc->off += snprintf (&rdc->buf[rdc->off], | 281 | rdc->off += snprintf (&rdc->buf[rdc->off], |
281 | rdc->buf_len - rdc->off, | 282 | rdc->buf_len - rdc->off, |
282 | "<li><a href=\"/%s\">%s</a></li>\n", | 283 | "<li><a href=\"/%s\">%s</a></li>\n", |
283 | de->d_name, | 284 | fullname, |
284 | de->d_name); | 285 | de->d_name); |
285 | } | 286 | } |
286 | (void) closedir (dir); | 287 | (void) closedir (dir); |
@@ -472,6 +473,7 @@ process_upload_data (void *cls, | |||
472 | size_t size) | 473 | size_t size) |
473 | { | 474 | { |
474 | struct UploadContext *uc = cls; | 475 | struct UploadContext *uc = cls; |
476 | int i; | ||
475 | 477 | ||
476 | if (0 == strcmp (key, "category")) | 478 | if (0 == strcmp (key, "category")) |
477 | return do_append (&uc->category, data, size); | 479 | return do_append (&uc->category, data, size); |
@@ -529,7 +531,10 @@ process_upload_data (void *cls, | |||
529 | "%s/%s/%s", | 531 | "%s/%s/%s", |
530 | uc->language, | 532 | uc->language, |
531 | uc->category, | 533 | uc->category, |
532 | filename); | 534 | filename); |
535 | for (i=strlen (fn)-1;i>=0;i--) | ||
536 | if (! isprint ((int) fn[i])) | ||
537 | fn[i] = '_'; | ||
533 | uc->fd = open (fn, | 538 | uc->fd = open (fn, |
534 | O_CREAT | O_EXCL | 539 | O_CREAT | O_EXCL |
535 | #if O_LARGEFILE | 540 | #if O_LARGEFILE |