$OpenBSD: patch-utils_sercmd_sercmd_c,v 1.1 2012/09/15 12:16:18 sthen Exp $
--- utils/sercmd/sercmd.c.orig	Sun Jul 29 23:49:56 2012
+++ utils/sercmd/sercmd.c	Sun Jul 29 23:51:28 2012
@@ -471,9 +471,9 @@ int connect_unix_sock(char* name, int type)
 	s=-1;
 	memset(&ifsun, 0, sizeof (struct sockaddr_un));
 	len=strlen(name);
-	if (len>UNIX_PATH_MAX){
+	if (len>sizeof(ifsun.sun_path)){
 		fprintf(stderr, "ERROR: connect_unix_sock: name too long "
-				"(%d > %d): %s\n", len, UNIX_PATH_MAX, name);
+				"(%d > %ld): %s\n", len, sizeof(ifsun.sun_path), name);
 		goto error;
 	}
 	ifsun.sun_family=AF_UNIX;
@@ -493,15 +493,15 @@ int connect_unix_sock(char* name, int type)
 			if (sock_dir==0)
 				sock_dir="/tmp";
 retry:
-			ret=snprintf(mysun.sun_path, UNIX_PATH_MAX, "%s/" NAME "_%d",
+			ret=snprintf(mysun.sun_path, sizeof(mysun.sun_path), "%s/" NAME "_%d",
 							sock_dir, rand()); 
-			if ((ret<0) ||(ret>=UNIX_PATH_MAX)){
+			if ((ret<0) ||(ret>=sizeof(mysun.sun_path))){
 				fprintf(stderr, "ERROR: buffer overflow while trying to"
 							"generate unix datagram socket name");
 				goto error;
 			}
 		}else{
-			if (strlen(reply_socket)>UNIX_PATH_MAX){
+			if (strlen(reply_socket)>sizeof(mysun.sun_path)){
 				fprintf(stderr, "ERROR: buffer overflow while trying to"
 							"use the provided unix datagram socket name (%s)",
 							reply_socket);
