parent
2f7839fa42
commit
43d6f6b16a
|
@ -22,6 +22,17 @@
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#ifdef __sgi
|
||||||
|
#include <string.h>
|
||||||
|
#define errx(exitcode, format, args...) \
|
||||||
|
{ \
|
||||||
|
warnx(format, ##args); \
|
||||||
|
exit(exitcode); \
|
||||||
|
}
|
||||||
|
#define warnx(format, args...) fprintf(stderr, format "\n", ##args)
|
||||||
|
char *strndup(const char *s, size_t size);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif /* HAVE_CONFIG_H */
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
@ -37,7 +48,9 @@
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif /* HAVE_NETINET_IN_H */
|
#endif /* HAVE_NETINET_IN_H */
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
|
#ifndef __sgi
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#endif
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
|
|
|
@ -22,6 +22,16 @@
|
||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#ifdef __sgi
|
||||||
|
#define errx(exitcode, format, args...) \
|
||||||
|
{ \
|
||||||
|
warnx(format, ##args); \
|
||||||
|
exit(exitcode); \
|
||||||
|
}
|
||||||
|
#define warn(format, args...) warnx(format ": %s", ##args, strerror(errno))
|
||||||
|
#define warnx(format, args...) fprintf(stderr, format "\n", ##args)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif /* HAVE_CONFIG_H */
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
@ -46,7 +56,9 @@
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif /* HAVE_NETINET_IN_H */
|
#endif /* HAVE_NETINET_IN_H */
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
|
#ifndef __sgi
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
|
@ -672,7 +684,7 @@ static void start_listen(struct event_base *evbase, const char *service,
|
||||||
|
|
||||||
rv = getaddrinfo(NULL, service, &hints, &res);
|
rv = getaddrinfo(NULL, service, &hints, &res);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
errx(1, NULL);
|
errx(1, "Could not resolve server address");
|
||||||
}
|
}
|
||||||
for (rp = res; rp; rp = rp->ai_next) {
|
for (rp = res; rp; rp = rp->ai_next) {
|
||||||
struct evconnlistener *listener;
|
struct evconnlistener *listener;
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
*/
|
*/
|
||||||
#include "nghttp2_config.h"
|
#include "nghttp2_config.h"
|
||||||
|
|
||||||
|
#ifdef __sgi
|
||||||
|
#define daemon _daemonize
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif // HAVE_UNISTD_H
|
#endif // HAVE_UNISTD_H
|
||||||
|
@ -352,7 +356,11 @@ int main(int argc, char **argv) {
|
||||||
std::cerr << "-d option must be specified when -D is used." << std::endl;
|
std::cerr << "-d option must be specified when -D is used." << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
#ifdef __sgi
|
||||||
|
if (daemon(0, 0, 0, 0) == -1) {
|
||||||
|
#else
|
||||||
if (daemon(0, 0) == -1) {
|
if (daemon(0, 0) == -1) {
|
||||||
|
#endif
|
||||||
perror("daemon");
|
perror("daemon");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue