Skip to content

Commit

Permalink
SunOS compile support: add -lrt to support nanosleep(); add definitio…
Browse files Browse the repository at this point in the history
…n of strndup()
  • Loading branch information
Aaron Lewis committed Dec 29, 2016
1 parent 796992d commit 34f5d55
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions hydra-http-form.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]> */
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));
Expand Down

0 comments on commit 34f5d55

Please sign in to comment.