sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

ii-solarisbuild-20180912-b25423f.diff (1848B)


      1 From d5b8f78857f62247f6efbccfb9382549d56ccf3e Mon Sep 17 00:00:00 2001
      2 From: drowl <mail@catsnest.co.uk>
      3 Date: Wed, 12 Sep 2018 16:56:16 +0100
      4 Subject: [PATCH] Compiling on solaris
      5 
      6 ---
      7  config.mk |  6 +++++-
      8  ii.c      | 10 +++++-----
      9  2 files changed, 10 insertions(+), 6 deletions(-)
     10 
     11 diff --git a/config.mk b/config.mk
     12 index 957bae0..206a08c 100644
     13 --- a/config.mk
     14 +++ b/config.mk
     15 @@ -6,9 +6,13 @@ PREFIX    = /usr/local
     16  MANPREFIX = ${PREFIX}/share/man
     17  DOCPREFIX = ${PREFIX}/share/doc
     18  
     19 +#  On Solaris systems we still need to include some extra librarys namely "sockets"
     20 +#  Uncomment the next line if compiling on Solaris
     21 +# SOL_LIBS = -lsocket
     22 +
     23  # on systems which provide strlcpy(3),
     24  # remove NEED_STRLCPY from CFLAGS and
     25  # remove strlcpy.o from LIBS
     26  CFLAGS   = -DNEED_STRLCPY -Os
     27  LDFLAGS  = -s
     28 -LIBS     = strlcpy.o
     29 +LIBS     = strlcpy.o ${SOL_LIBS}
     30 diff --git a/ii.c b/ii.c
     31 index 6c87314..b174088 100644
     32 --- a/ii.c
     33 +++ b/ii.c
     34 @@ -338,7 +338,7 @@ loginuser(int ircfd, const char *host, const char *fullname)
     35  static int
     36  udsopen(const char *uds)
     37  {
     38 -	struct sockaddr_un sun;
     39 +	struct sockaddr_un sunn;
     40  	size_t len;
     41  	int fd;
     42  
     43 @@ -347,13 +347,13 @@ udsopen(const char *uds)
     44  		exit(1);
     45  	}
     46  
     47 -	sun.sun_family = AF_UNIX;
     48 -	if (strlcpy(sun.sun_path, uds, sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) {
     49 +	sunn.sun_family = AF_UNIX;
     50 +	if (strlcpy(sunn.sun_path, uds, sizeof(sunn.sun_path)) >= sizeof(sunn.sun_path)) {
     51  		fprintf(stderr, "%s: UNIX domain socket path truncation\n", argv0);
     52  		exit(1);
     53  	}
     54 -	len = strlen(sun.sun_path) + 1 + sizeof(sun.sun_family);
     55 -	if (connect(fd, (struct sockaddr *)&sun, len) == -1) {
     56 +	len = strlen(sunn.sun_path) + 1 + sizeof(sunn.sun_family);
     57 +	if (connect(fd, (struct sockaddr *)&sunn, len) == -1) {
     58  		fprintf(stderr, "%s: connect: %s\n", argv0, strerror(errno));
     59  		exit(1);
     60  	}
     61 -- 
     62 2.15.0
     63