Compile with IRIX gcc-4.7

Patch from Klaus Ziegler
This commit is contained in:
Tatsuhiro Tsujikawa 2015-07-01 21:30:27 +09:00
parent 2f7839fa42
commit 43d6f6b16a
3 changed files with 34 additions and 1 deletions

View File

@ -22,6 +22,17 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* 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
#include <config.h>
#endif /* HAVE_CONFIG_H */
@ -37,7 +48,9 @@
#include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */
#include <netinet/tcp.h>
#ifndef __sgi
#include <err.h>
#endif
#include <signal.h>
#include <openssl/ssl.h>

View File

@ -22,6 +22,16 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* 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
#include <config.h>
#endif /* HAVE_CONFIG_H */
@ -46,7 +56,9 @@
#include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */
#include <netinet/tcp.h>
#ifndef __sgi
#include <err.h>
#endif
#include <openssl/ssl.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);
if (rv != 0) {
errx(1, NULL);
errx(1, "Could not resolve server address");
}
for (rp = res; rp; rp = rp->ai_next) {
struct evconnlistener *listener;

View File

@ -24,6 +24,10 @@
*/
#include "nghttp2_config.h"
#ifdef __sgi
#define daemon _daemonize
#endif
#ifdef HAVE_UNISTD_H
#include <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;
exit(EXIT_FAILURE);
}
#ifdef __sgi
if (daemon(0, 0, 0, 0) == -1) {
#else
if (daemon(0, 0) == -1) {
#endif
perror("daemon");
exit(EXIT_FAILURE);
}