summaryrefslogtreecommitdiffstats
path: root/cpukit/shttpd
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2007-07-30 07:54:14 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2007-07-30 07:54:14 +0000
commitf29163ab49a24dee9414dae623dc19d226e63db0 (patch)
tree9ac18115431ceab7b8d741aa66469827653db1cd /cpukit/shttpd
parent2007-07-28 Chris Johns <chisj@rtems.org> (diff)
downloadrtems-f29163ab49a24dee9414dae623dc19d226e63db0.tar.bz2
2007-07-30 Ralf Corsépius <ralf.corsepius@rtems.org>
* shttpd/log.c: Add preliminary version of SPLIT_SNPRINTF to work-around bug m68k/coldfire -fomit-frame-pointer bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32307.
Diffstat (limited to 'cpukit/shttpd')
-rw-r--r--cpukit/shttpd/log.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/cpukit/shttpd/log.c b/cpukit/shttpd/log.c
index 4b43610678..133d8e4d2c 100644
--- a/cpukit/shttpd/log.c
+++ b/cpukit/shttpd/log.c
@@ -61,6 +61,22 @@ elog(int flags, struct conn *c, const char *fmt, ...)
exit(EXIT_FAILURE);
}
+/* HACK: m68k-gcc <= 4.2.1 ICEs on the snprintf below for some
+ * coldfire variants for yet unknown reasons.
+ */
+#if defined(__GNUC__) && \
+ ( (__GNUC__ < 4 ) || \
+ ( (__GNUC__ == 4 ) && (__GNUC_MINOR__ < 2 ) ) || \
+ ( (__GNUC__ == 4 ) && (__GNUC_MINOR__ == 2 ) && (__GNUC_PATCHLEVEL__ <= 1 ) ) )
+#if defined(__mcf528x__)
+//# define SPLIT_SNPRINTF 1
+#endif /* __mcf528x__ */
+#if defined(__mcf5200__)
+#endif /* __mcf5200__ */
+#if defined(__mcoldfire__)
+#endif /* __mcoldfire__ */
+#endif /* __GNUC__ */
+
void
log_access(FILE *fp, const struct conn *c)
{
@@ -87,6 +103,19 @@ log_access(FILE *fp, const struct conn *c)
(void) strftime(date, sizeof(date), "%d/%b/%Y:%H:%M:%S",
localtime(&current_time));
+#if SPLIT_SNPRINTF
+ {
+ int num;
+ num = my_snprintf(buf, sizeof(buf),
+ "%s - %.*s [%s %+05d] \"%s\" %d %lu",
+ inet_ntoa(c->sa.u.sin.sin_addr), user->len, user->ptr,
+ date, tz_offset, c->request ? c->request : "-",
+ c->status, c->loc.io.total );
+ my_snprintf(&buf[num], sizeof(buf)-num, " %s%.*s%s" " %s%.*s%s",
+ q1, referer->len, referer->ptr, q1,
+ q2, user_agent->len, user_agent->ptr, q2);
+ }
+#else
(void) my_snprintf(buf, sizeof(buf),
"%s - %.*s [%s %+05d] \"%s\" %d %lu %s%.*s%s %s%.*s%s",
inet_ntoa(c->sa.u.sin.sin_addr), user->len, user->ptr,
@@ -94,6 +123,7 @@ log_access(FILE *fp, const struct conn *c)
c->status, (unsigned long) c->loc.io.total,
q1, referer->len, referer->ptr, q1,
q2, user_agent->len, user_agent->ptr, q2);
+#endif
if (fp != NULL) {
(void) fprintf(fp, "%s\n", buf);