diff options
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/ctl.c | 22 | ||||
-rw-r--r-- | src/pies.h | 16 |
3 files changed, 21 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac index 1ee26ec..d1bb2a9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,30 +1,30 @@ # This file is part of GNU Pies. -*- autoconf -*- -# Copyright (C) 2009-2015 Sergey Poznyakoff +# Copyright (C) 2009-2016 Sergey Poznyakoff # # GNU Pies is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Pies is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ([2.63]) -AC_INIT([GNU Pies], [1.2.91], [bug-pies@gnu.org.ua]) +AC_INIT([GNU Pies], [1.2.92], [bug-pies@gnu.org.ua]) AC_CONFIG_SRCDIR([src/pies.h]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 std-options silent-rules]) # Enable silent rules by default: AM_SILENT_RULES([yes]) # Checks for programs. AC_PROG_CC gl_EARLY AC_PROG_MAKE_SET @@ -646,40 +646,32 @@ ctlio_adjust_format (struct ctlio *io, struct json_format *fmt) return; if (strcasecmp (val, "pretty") == 0) fmt->indent = 2; } static void ctlio_finalize_reply (struct ctlio *io) { size_t size; char const *val; struct ctlbuf tmpbuf; - if (io->state & (CTL_INITIAL_STATE|CTL_AUTHENTICATED_STATE)) + val = http_get_header (io->input.headers, "connection"); + if (val) { - if (io->code / 100 == 2 || io->code == 401) - { - val = http_get_header (io->input.headers, "connection"); - if (val) - { - if (strcasecmp (val, "keep-alive") == 0) - /* nothing */; - else if (strcasecmp (val, "close") == 0) - io->state = CTL_END_STATE; - //FIXME: else? - } - } - else + if (strcasecmp (val, "keep-alive") == 0) + /* nothing */; + else if (strcasecmp (val, "close") == 0) io->state = CTL_END_STATE; + //FIXME: else? } if (io->state == CTL_END_STATE || io->state == CTL_ACTION_STATE) output_set_header (&io->output, "Connection", "close"); ctlbuf_init (&tmpbuf); if (io->output.reply) { struct json_format fmt = { .indent = 0, .precision = 0, .write = json_writer, @@ -1175,25 +1167,25 @@ ctl_open () pies_control_url (); fd = create_socket (control.url, SOCK_STREAM, NULL, 077); if (fd == -1) { logmsg (LOG_CRIT, _("can't create control socket %s"), control.url->string); exit (EX_UNAVAILABLE); } if (listen (fd, 8)) { logmsg (LOG_CRIT, "can't listen on control socket %s: %s", - strerror (errno)); + control.url->string, strerror (errno)); exit (EX_UNAVAILABLE); } register_socket (fd, ctl_accept, NULL, NULL, NULL); } static void idfmt_string (struct ctlio *io, char const *name, void *ptr) { json_object_set_string (io->output.reply, name, "%s", (char*) ptr); } @@ -410,38 +410,46 @@ int meta1parse (void); /* diag.c */ #define DIAG_TO_SYSLOG 0x1 #define DIAG_TO_STDERR 0x2 extern int diag_output; #define DIAG_OUTPUT(x) (diag_output & (x)) void diag_setup (int flags); -void logmsg (int prio, const char *fmt, ...); -void logmsg_printf (int prio, const char *fmt, ...); +#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +# define __attribute__(x) +#endif + +#ifndef PIES_PRINTFLIKE +# define PIES_PRINTFLIKE(fmt,narg) __attribute__ ((__format__ (__printf__, fmt, narg))) +#endif + +void logmsg (int prio, const char *fmt, ...) PIES_PRINTFLIKE(2,3); +void logmsg_printf (int prio, const char *fmt, ...) PIES_PRINTFLIKE(2,3); void logmsg_vprintf (int prio, const char *fmt, va_list ap); extern unsigned debug_level; extern int source_info_option; -void debug_msg (const char *fmt, ...); +void debug_msg (const char *fmt, ...) PIES_PRINTFLIKE(1,2); #define debug(lev, args) \ do \ if (debug_level >= lev) \ { \ if (source_info_option) \ - logmsg_printf (LOG_DEBUG, "%s:%lu:%s: ", \ + logmsg_printf (LOG_DEBUG, "%s:%d:%s: ", \ __FILE__, __LINE__, __FUNCTION__); \ debug_msg args; \ } \ while (0) /* meta.c */ struct metadef { char *kw; char *value; const char *(*expand) (struct metadef *, void *); |