From 34f5d55b8490ba7f542988e9682f639b006f64a7 Mon Sep 17 00:00:00 2001 From: Aaron Lewis Date: Thu, 29 Dec 2016 17:03:46 +0800 Subject: [PATCH] SunOS compile support: add -lrt to support nanosleep(); add definition of strndup() --- configure | 6 +++++- hydra-http-form.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/configure b/configure index ef77d8f..90969e4 100755 --- a/configure +++ b/configure @@ -1220,6 +1220,10 @@ if [ "X" != "X$DEBUG" ]; then echo DEBUG: STRIP=$STRIP fi +if [ "$SYSS" = "SunOS" ]; then + XLIBS="$XLIBS -lrt" +fi + echo "Writing Makefile.in ..." if [ "X" != "X$FHS" ]; then echo "MANDIR = /share/man/man1" >> Makefile.in @@ -1263,7 +1267,7 @@ if [ "x$WINDRES" = "x" ]; then echo HYDRA_LOGO= >> Makefile echo PWI_LOGO= >> Makefile fi -if [ "$GCCSEC" = "yes" ]; then +if [ "$GCCSEC" = "yes" ] && [ "$SYSS" != "SunOS" ]; then echo "SEC=$GCCSECOPT" >> Makefile else echo "SEC=" >> Makefile diff --git a/hydra-http-form.c b/hydra-http-form.c index f051626..116e463 100644 --- a/hydra-http-form.c +++ b/hydra-http-form.c @@ -114,6 +114,27 @@ ptr_header_node header_exists(ptr_header_node * ptr_head, char *header_name, cha return found_header; } +#if defined(__sun) +/* Written by Kaveh R. Ghazi */ +char * +strndup (const char *s, size_t n) +{ + char *result; + size_t len = strlen (s); + + if (n < len) + len = n; + + result = (char *) malloc (len + 1); + if (!result) + return 0; + + memcpy (result, s, len); + result[len] = '\0'; + return(result); +} +#endif + int append_cookie(char *name, char *value, ptr_cookie_node *last_cookie) { ptr_cookie_node new_ptr = (ptr_cookie_node) malloc(sizeof(t_cookie_node));