Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Apr 2000 19:10:54 -0400 (EDT)
From:      mi@privatelabs.com
To:        gnats-admin@FreeBSD.org
Cc:        freebsd-ports@FreeBSD.org
Subject:   Re: ports/18216: sysutils/upsmon port broken (does not compile)
Message-ID:  <200004252310.TAA71878@misha.privatelabs.com>
In-Reply-To: <200004252140.OAA23846@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--0-719885386-956704259=:75786
Content-Type: TEXT/plain; CHARSET=US-ASCII

On 25 Apr, gnats-admin@FreeBSD.org wrote:
= >Category:       ports
= >Responsible:    freebsd-ports
= >Synopsis:       sysutils/upsmon port broken (does not compile)
= >Arrival-Date:   Tue Apr 25 14:40:01 PDT 2000

I  believe, I  have the  fix  for the  port.  My fix  addresses the  CXX
problem, the casting  problem (that prevented the  compilation), and the
crash that  happens if upsstat is  used when upsmond did  not connect to
the UPS  unit or  if the UPS  unit failed to  respond to  the GET_STATUS
request properly. I  also modified the port's Makefile  not to overwrite
the ${PREFIX}/etc/rc.d/upsmond.sh if it is already present.

	-mi

--0-719885386-956704259=:75786
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Description: Patch for sysutils/upsmon port (see ports/18216).
Content-Disposition: attachment ; filename="upsmon-port-patch"

--- Makefile	Tue Apr 25 17:41:57 2000
+++ Makefile	Tue Apr 25 18:56:02 2000
@@ -20,5 +20,5 @@
 	${INSTALL_PROGRAM} ${WRKSRC}/upsmond ${PREFIX}/sbin
-
-	${SED} -e 's#!!PREFIX!!#${PREFIX}#g' ${FILESDIR}/upsmon.sh \
-	> ${PREFIX}/etc/rc.d/upsmon.sh
+	${TEST} -e ${PREFIX}/etc/rc.d/upsmon.sh || \
+		${SED} -e 's#!!PREFIX!!#${PREFIX}#g' ${FILESDIR}/upsmon.sh \
+			> ${PREFIX}/etc/rc.d/upsmon.sh
 	@${CHMOD} +x ${PREFIX}/etc/rc.d/upsmon.sh
--- /dev/null	Tue Apr 25 18:51:25 2000
+++ patches/patch-ab	Tue Apr 25 17:41:42 2000
@@ -0,0 +1,7 @@
+--- csocket.cc	Tue Aug  4 17:18:14 1998
++++ csocket.cc	Tue Apr 25 17:40:42 2000
+@@ -87,3 +87,3 @@
+ 
+-    m_fdSocketNormal = accept(m_fdSocketServer,(struct sockaddr *)&m_saunRemote,&m_iRemoteAddrLen);
++    m_fdSocketNormal = accept(m_fdSocketServer,(struct sockaddr *)&m_saunRemote,&(socklen_t)m_iRemoteAddrLen);
+     if(m_fdSocketNormal < 0)
--- /dev/null	Tue Apr 25 18:51:25 2000
+++ patches/patch-ac	Tue Apr 25 18:50:05 2000
@@ -0,0 +1,25 @@
+This patch prevents the upsmond from crashing when UPS is not
+connected or when it failed to respond to the UPS_GET_STATUS
+for some reason.	-mi
+--- upsmonitor.cc	Tue Aug  4 17:18:14 1998
++++ upsmonitor.cc	Tue Apr 25 18:45:59 2000
+@@ -175,2 +175,3 @@
+     CBuffer *pbufSend;        // socket send buffer
++    const char *model_version;
+ 
+@@ -183,5 +184,9 @@
+     pResp->iFunctionID = UPS_GET_STATUS;
+-    pResp->iRetCode = RC_SUCCESS;
+     strcpy(pResp->szUpsmondVersion,m_szUpsmondVersion);
+-    strcpy(pResp->szModel,m_pUps->ReadString(UPS_CMD_MODEL));
++    if ((model_version = m_pUps->ReadString(UPS_CMD_MODEL)) == NULL) {
++	pResp->iRetCode = RC_FAILED;
++	goto Write;
++    }
++    pResp->iRetCode = RC_SUCCESS;
++    strcpy(pResp->szModel,model_version);
+     strcpy(pResp->szCopyRight,m_pUps->ReadString(UPS_CMD_COPYRIGHT));
+@@ -203,2 +208,3 @@
+     pResp->dBatteryLevel = m_pUps->ReadDouble(UPS_CMD_LEVEL);
++Write:
+     pbufSend->SetLength(sizeof(UpsInfoResp));
--- patches/patch-aa	Tue Nov 24 17:43:40 1998
+++ patches/patch-aa	Tue Apr 25 19:07:08 2000
@@ -5,3 +5,4 @@
  
- CC = gcc
+-CC = gcc
++CC = ${CXX}
 -CFLAGS_DEBUG = -O2 -Wall -DDEBUG -g
@@ -13,6 +14,6 @@
 -CFLAGS = $(CFLAGS_DEBUG)
-+CFLAGS += $(CFLAGS_DEBUG)
++CFLAGS = ${CXXFLAGS} $(CFLAGS_DEBUG)
  .else
 -CFLAGS = $(CFLAGS_NODEBUG)
-+CFLAGS += $(CFLAGS_NODEBUG)
++CFLAGS = ${CXXFLAGS} $(CFLAGS_NODEBUG)
  .endif
--- pkg/MESSAGE	Tue Nov 24 17:43:40 1998
+++ pkg/MESSAGE	Tue Apr 25 18:52:33 2000
@@ -5,5 +5 @@
 option details.
-
-NOTE: upsmond will dump core if you start upsstat without
-      SmartUPS properly attached to the specified port.
-

--0-719885386-956704259=:75786--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004252310.TAA71878>