From owner-svn-ports-head@FreeBSD.ORG Mon Dec 22 13:47:19 2014 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E2AF77DA; Mon, 22 Dec 2014 13:47:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDBC064362; Mon, 22 Dec 2014 13:47:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBMDlIaR046542; Mon, 22 Dec 2014 13:47:18 GMT (envelope-from rodrigo@FreeBSD.org) Received: (from rodrigo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBMDlIqU046538; Mon, 22 Dec 2014 13:47:18 GMT (envelope-from rodrigo@FreeBSD.org) Message-Id: <201412221347.sBMDlIqU046538@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rodrigo set sender to rodrigo@FreeBSD.org using -f From: Rodrigo Osorio Date: Mon, 22 Dec 2014 13:47:18 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r375237 - in head/www/fcgiwrap: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2014 13:47:19 -0000 Author: rodrigo Date: Mon Dec 22 13:47:17 2014 New Revision: 375237 URL: https://svnweb.freebsd.org/changeset/ports/375237 QAT: https://qat.redports.org/buildarchive/r375237/ Log: - Fix issue on restart after reboot, fcgiwrap doesn't handle properly unix sockets bind errors (https://github.com/gnosek/fcgiwrap/pull/26) - Bump port revision PR: ports/192681 Submitted by: freebsd@skysmurf.nl (maintainer) Modified: head/www/fcgiwrap/Makefile head/www/fcgiwrap/files/patch-fcgiwrap.c Modified: head/www/fcgiwrap/Makefile ============================================================================== --- head/www/fcgiwrap/Makefile Mon Dec 22 13:29:53 2014 (r375236) +++ head/www/fcgiwrap/Makefile Mon Dec 22 13:47:17 2014 (r375237) @@ -2,7 +2,7 @@ PORTNAME= fcgiwrap PORTVERSION= 1.1.0 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= www MASTER_SITES= GH \ http://www.skysmurf.nl/comp/FreeBSD/distfiles/ Modified: head/www/fcgiwrap/files/patch-fcgiwrap.c ============================================================================== --- head/www/fcgiwrap/files/patch-fcgiwrap.c Mon Dec 22 13:29:53 2014 (r375236) +++ head/www/fcgiwrap/files/patch-fcgiwrap.c Mon Dec 22 13:47:17 2014 (r375237) @@ -1,5 +1,5 @@ ---- fcgiwrap.c.orig 2014-09-22 12:36:32.000000000 +0200 -+++ fcgiwrap.c 2014-09-22 12:41:59.000000000 +0200 +--- fcgiwrap.c.orig 2013-02-03 14:25:17.000000000 +0100 ++++ fcgiwrap.c 2014-12-22 13:25:23.000000000 +0100 @@ -43,6 +43,7 @@ #include @@ -47,8 +47,59 @@ last_slash = strrchr(filename, '/'); if (!last_slash) cgi_error("403 Forbidden", "Script name must be a fully qualified path", filename); -@@ -760,7 +779,7 @@ +@@ -587,14 +606,29 @@ + FCGI_puts("System error"); + } + ++static volatile sig_atomic_t sigint_received; ++static void sigint_handler(int __attribute__((__unused__))dummy) ++{ ++ sigint_received = 1; ++ FCGX_ShutdownPending(); // Or we could send SIGUSR1 ++} ++ + static void fcgiwrap_main(void) + { ++ struct sigaction a; + signal(SIGCHLD, SIG_IGN); + signal(SIGPIPE, SIG_IGN); + ++ // Use sigaction for SIGINT so we can avoid SA_RESTART and actually react ++ a.sa_handler = sigint_handler; ++ a.sa_flags = 0; ++ sigemptyset(&a.sa_mask); ++ sigaction(SIGINT, &a, NULL); ++ sigaction(SIGTERM, &a, NULL); ++ + inherited_environ = environ; + +- while (FCGI_Accept() >= 0) { ++ while (FCGI_Accept() >= 0 && !sigint_received) { + handle_fcgi_request(); + } + } +@@ -671,7 +705,7 @@ + return 0; + } + +-static int setup_socket(char *url) { ++static int setup_socket(char *url, int *fd_out) { + char *p = url; + char *q; + int fd; +@@ -751,6 +785,7 @@ + return -1; + } + ++ *fd_out = fd; + return listen_on_fd(fd); + } + +@@ -758,9 +793,10 @@ + { + int nchildren = 1; char *socket_url = NULL; ++ int fd = 0; int c; - while ((c = getopt(argc, argv, "c:hfs:")) != -1) { @@ -56,7 +107,7 @@ switch (c) { case 'f': stderr_to_fastcgi++; -@@ -773,6 +792,7 @@ +@@ -773,6 +809,7 @@ " -c \t\tNumber of processes to prefork\n" " -s \tSocket to bind to (say -s help for help)\n" " -h\t\t\tShow this help message and exit\n" @@ -64,7 +115,7 @@ "\nReport bugs to Grzegorz Nosek <"PACKAGE_BUGREPORT">.\n" PACKAGE_NAME" home page: \n", argv[0] -@@ -784,8 +804,14 @@ +@@ -784,8 +821,14 @@ case 's': socket_url = strdup(optarg); break; @@ -80,3 +131,30 @@ fprintf(stderr, "Option -%c requires an argument.\n", optopt); else if (isprint(optopt)) fprintf(stderr, "Unknown option `-%c'.\n", optopt); +@@ -808,13 +851,24 @@ + } else + #endif + if (socket_url) { +- if (setup_socket(socket_url) < 0) { ++ if (setup_socket(socket_url, &fd) < 0) { + return 1; + } +- free(socket_url); + } + + prefork(nchildren); + fcgiwrap_main(); ++ if(fd) { ++ const char *p = socket_url; ++ close(fd); ++ ++ if(socket_url) { ++ if (!strncmp(p, "unix:", sizeof("unix:") - 1)) { ++ p += sizeof("unix:") - 1; ++ unlink(p); ++ } ++ free(socket_url); ++ } ++ } + return 0; + }