Dolda2000 GitWeb
/
ashd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
755faed
)
Don't close the filedescriptors passed to simpleerror or stdredir.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 24 Aug 2010 19:45:03 +0000
(21:45 +0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 24 Aug 2010 19:45:03 +0000
(21:45 +0200)
lib/resp.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/resp.c
b/lib/resp.c
index
c1b74b9
..
9dfb481
100644
(file)
--- a/
lib/resp.c
+++ b/
lib/resp.c
@@
-17,6
+17,7
@@
*/
#include <stdlib.h>
*/
#include <stdlib.h>
+#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
@@
-73,7
+74,7
@@
void simpleerror(int fd, int code, char *msg, char *fmt, ...)
bufcatstr(buf, "</body>\r\n");
bufcatstr(buf, "</html>\r\n");
free(tmp2);
bufcatstr(buf, "</body>\r\n");
bufcatstr(buf, "</html>\r\n");
free(tmp2);
- out = fdopen(
fd
, "w");
+ out = fdopen(
dup(fd)
, "w");
fprintf(out, "HTTP/1.1 %i %s\n", code, msg);
fprintf(out, "Content-Type: text/html\n");
fprintf(out, "Content-Length: %zi\n", buf.d);
fprintf(out, "HTTP/1.1 %i %s\n", code, msg);
fprintf(out, "Content-Type: text/html\n");
fprintf(out, "Content-Length: %zi\n", buf.d);
@@
-115,7
+116,7
@@
void stdredir(struct hthead *req, int fd, int code, char *dst)
free(path);
}
}
free(path);
}
}
- out = fdopen(
fd
, "w");
+ out = fdopen(
dup(fd)
, "w");
fprintf(out, "HTTP/1.1 %i Redirection\n", code);
fprintf(out, "Content-Length: 0\n");
fprintf(out, "Location: %s\n", adst);
fprintf(out, "HTTP/1.1 %i Redirection\n", code);
fprintf(out, "Content-Length: 0\n");
fprintf(out, "Location: %s\n", adst);