diff options
author | ng0@n0.is <ng0@n0.is> | 2019-06-05 11:54:39 +0000 |
---|---|---|
committer | ng0@n0.is <ng0@n0.is> | 2019-06-05 11:54:39 +0000 |
commit | 7636d038a6351d8a7ac47d10c796cceaabd54f1c (patch) | |
tree | 4f293021b2150d07dd9e78f4b4661bf3a9388bf4 | |
parent | f1ca5ca7ebe46d86725549039aec77d9a94a0f2c (diff) | |
download | libmicrohttpd-gsoc2019-7636d038a6351d8a7ac47d10c796cceaabd54f1c.tar.gz libmicrohttpd-gsoc2019-7636d038a6351d8a7ac47d10c796cceaabd54f1c.zip |
debian?
-rw-r--r-- | response_generation_sendfile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/response_generation_sendfile.c b/response_generation_sendfile.c index df1485f..5833364 100644 --- a/response_generation_sendfile.c +++ b/response_generation_sendfile.c | |||
@@ -30,11 +30,13 @@ answer_to_connection (void *cls, | |||
30 | (0 != strcmp (method, MHD_HTTP_METHOD_HEAD))) | 30 | (0 != strcmp (method, MHD_HTTP_METHOD_HEAD))) |
31 | return MHD_NO; | 31 | return MHD_NO; |
32 | FILE *fp; | 32 | FILE *fp; |
33 | fp = fopen ("a.txt", "w"); | 33 | if ((fp = fopen ("a.txt", "w")) == NULL) |
34 | return 1; | ||
34 | fprintf (fp, "a"); | 35 | fprintf (fp, "a"); |
35 | fclose (fp); | 36 | fclose (fp); |
36 | const char *file = "./a.txt"; | 37 | const char *file = "./a.txt"; |
37 | fd = open (file, O_RDONLY); | 38 | if ((fd = open (file, O_RDONLY)) == -1) |
39 | return 1; | ||
38 | response = MHD_create_response_from_fd64 (buf.st_size, fd); | 40 | response = MHD_create_response_from_fd64 (buf.st_size, fd); |
39 | if (NULL == response) | 41 | if (NULL == response) |
40 | { | 42 | { |