Thread (1 message) 1 message, 1 author, 2016-06-15
DORMANTno replies

[PATCH] getdomainname should be usable on SunOS with -lnsl

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:05
Subsystem: kernel build + files below scripts/ (unless maintained elsewhere), the rest · Maintainers: Nathan Chancellor, Nicolas Schier, Linus Torvalds

Jason Riedy suggests that we should be able to use getdomainname
if we properly specify which libraries to link.

Signed-off-by: Junio C Hamano <redacted>

---

 I've tried this on an ancient Solaris machine I happened to
 have access at work and it seems to link OK.  Patrick, could
 you try this and see if it works OK for you?

 Makefile |    6 +++++-
 ident.c  |    2 --
 2 files changed, 5 insertions(+), 3 deletions(-)

2b6a27b6157c6ee472d654dbcaf380aec00d6444
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -148,7 +148,7 @@ ifeq ($(shell uname -s),Darwin)
 endif
 ifeq ($(shell uname -s),SunOS)
 	NEEDS_SOCKET = YesPlease
-	PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
+	NEEDS_NSL = YesPlease
 endif
 
 ifndef SHELL_PATH
@@ -195,6 +195,10 @@ ifdef NEEDS_SOCKET
 	LIBS += -lsocket
 	SIMPLE_LIB += -lsocket
 endif
+ifdef NEEDS_NSL
+	LIBS += -lnsl
+	SIMPLE_LIB += -lnsl
+endif
 
 DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
 
diff --git a/ident.c b/ident.c
--- a/ident.c
+++ b/ident.c
@@ -36,13 +36,11 @@ int setup_ident(void)
 	memcpy(real_email, pw->pw_name, len);
 	real_email[len++] = '@';
 	gethostname(real_email + len, sizeof(real_email) - len);
-#ifndef NO_GETDOMAINNAME
 	if (!strchr(real_email+len, '.')) {
 		len = strlen(real_email);
 		real_email[len++] = '.';
 		getdomainname(real_email+len, sizeof(real_email)-len);
 	}
-#endif
 	/* And set the default date */
 	datestamp(real_date, sizeof(real_date));
 	return 0;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help