aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malone <dwmalone@FreeBSD.org>2009-03-17 19:51:04 +0000
committerDavid Malone <dwmalone@FreeBSD.org>2009-03-17 19:51:04 +0000
commit8f27a91f74486d44b5c7d1d12ccf8151ed230b28 (patch)
tree3a8c5de2ec64f760d49866aa399d85ccc726958c
parente8c2f0b3aa200c6cc15d3b24043b94dbc2039da6 (diff)
downloadsrc-8f27a91f74486d44b5c7d1d12ccf8151ed230b28.tar.gz
src-8f27a91f74486d44b5c7d1d12ccf8151ed230b28.zip
Warns fixes: use putenv rather than setenv to avoid constness problems,
when we want to print an off_t cast to intmax_t and use %jd. Up WARNS to 6.
Notes
Notes: svn path=/head/; revision=189936
-rw-r--r--release/picobsd/tinyware/simple_httpd/Makefile1
-rw-r--r--release/picobsd/tinyware/simple_httpd/simple_httpd.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/release/picobsd/tinyware/simple_httpd/Makefile b/release/picobsd/tinyware/simple_httpd/Makefile
index cb4b149e5470..abd4bd89872a 100644
--- a/release/picobsd/tinyware/simple_httpd/Makefile
+++ b/release/picobsd/tinyware/simple_httpd/Makefile
@@ -3,5 +3,6 @@
PROG=simple_httpd
SRCS= simple_httpd.c
NO_MAN=
+WARNS?=6
.include <bsd.prog.mk>
diff --git a/release/picobsd/tinyware/simple_httpd/simple_httpd.c b/release/picobsd/tinyware/simple_httpd/simple_httpd.c
index ab35b55ae04c..0d53a09910e8 100644
--- a/release/picobsd/tinyware/simple_httpd/simple_httpd.c
+++ b/release/picobsd/tinyware/simple_httpd/simple_httpd.c
@@ -42,6 +42,7 @@
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@@ -278,7 +279,7 @@ http_request(void)
/*printf("HTTP/1.0 200 OK\nContent-type: text/html\n\n\n");*/
printf("HTTP/1.0 200 OK\r\n");
/* Plug in environment variable, others in log_line */
- putenv("SERVER_SOFTWARE=FreeBSD/PicoBSD");
+ setenv("SERVER_SOFTWARE", "FreeBSD/PicoBSD", 1);
execlp (filename,filename,par,(char *)0);
}
@@ -331,7 +332,7 @@ http_request(void)
http_output(httpd_server_ident);
http_date();
- sprintf(buff, "Content-length: %lld\r\n", file_status.st_size);
+ sprintf(buff, "Content-length: %jd\r\n", (intmax_t)file_status.st_size);
write(con_sock, buff, strlen(buff));
strcpy(buff, "Content-type: ");