Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Michal Hlavinka
a8a8415fa3 fix apcaccess crash if apcupsd is not running (#1236367,#1197383)
- enabled modbus-usb (#1195071)
- add bigger icon (#1157532)
2015-11-23 14:20:29 +01:00
Michal Hlavinka
0928aa6e8a apcupsd updated to 3.14.13 2015-02-03 16:31:55 +01:00
8 changed files with 83 additions and 3139 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ apcupsd-3.14.8.tar.gz
/apcupsd-3.14.10.tar.gz
/apcupsd-3.14.11.tar.gz
/apcupsd-3.14.12.tar.gz
/apcupsd-3.14.13.tar.gz

View file

@ -1,26 +0,0 @@
diff -up apcupsd-3.14.10/src/drivers/snmplite/asn.cpp.nodbg apcupsd-3.14.10/src/drivers/snmplite/asn.cpp
--- apcupsd-3.14.10/src/drivers/snmplite/asn.cpp.nodbg 2010-09-07 17:35:13.000000000 +0200
+++ apcupsd-3.14.10/src/drivers/snmplite/asn.cpp 2014-01-21 17:07:27.603049214 +0100
@@ -26,10 +26,13 @@
#include <stdlib.h>
#include <stdio.h>
+extern int debug_level;
+
using namespace Asn;
void debug(const char *foo, int indent)
{
+ if (!debug_level) return;
while (indent--)
printf(" ");
printf("%s\n", foo);
@@ -86,7 +89,7 @@ Object *Object::Demarshal(unsigned char
obj = new Sequence(type);
break;
default:
- printf("UNKNOWN ASN type=0x%02x\n", type);
+ if (debug_level) printf("UNKNOWN ASN type=0x%02x\n", type);
debug("UNKNOWN", indent);
obj = NULL;
break;

View file

@ -0,0 +1,63 @@
diff -up apcupsd-3.14.13/src/apcaccess.c.netopenfix apcupsd-3.14.13/src/apcaccess.c
--- apcupsd-3.14.13/src/apcaccess.c.netopenfix 2015-11-23 13:03:18.960051659 +0100
+++ apcupsd-3.14.13/src/apcaccess.c 2015-11-23 13:07:37.225759158 +0100
@@ -49,7 +49,7 @@ static int do_pthreads_status(const char
char recvline[MAXSTRING + 1];
char *line;
- if ((sockfd = net_open(host, NULL, port)) == INVALID_SOCKET) {
+ if ((sockfd = net_open(host, NULL, port)) < 0) {
fprintf(stderr, "Error contacting apcupsd @ %s:%d: %s\n",
host, port, strerror(-sockfd));
return 1;
diff -up apcupsd-3.14.13/src/cgi/upsfetch.c.netopenfix apcupsd-3.14.13/src/cgi/upsfetch.c
--- apcupsd-3.14.13/src/cgi/upsfetch.c.netopenfix 2015-11-23 13:09:20.108837721 +0100
+++ apcupsd-3.14.13/src/cgi/upsfetch.c 2015-11-23 13:09:20.153838193 +0100
@@ -114,7 +114,7 @@ static int fetch_data(const char *host)
*p++ = '\0';
nis_port = atoi(p);
}
- if ((sockfd = net_open(lhost, NULL, nis_port)) == INVALID_SOCKET) {
+ if ((sockfd = net_open(lhost, NULL, nis_port)) < 0) {
(void) snprintf(errmsg, sizeof (errmsg),
"upsfetch: tcp_open failed for %s port %d", lhost, nis_port);
return 0;
@@ -153,7 +153,7 @@ int fetch_events(const char *host)
*p++ = '\0';
nis_port = atoi(p);
}
- if ((sockfd = net_open(lhost, NULL, nis_port)) == INVALID_SOCKET) {
+ if ((sockfd = net_open(lhost, NULL, nis_port)) < 0) {
snprintf(errmsg, sizeof(errmsg),
"upsfetch: tcp_open failed for %s port %d", lhost, nis_port);
fputs(errmsg, stdout);
diff -up apcupsd-3.14.13/src/drivers/net/net.c.netopenfix apcupsd-3.14.13/src/drivers/net/net.c
--- apcupsd-3.14.13/src/drivers/net/net.c.netopenfix 2015-11-23 13:09:33.997983325 +0100
+++ apcupsd-3.14.13/src/drivers/net/net.c 2015-11-23 13:09:34.041983787 +0100
@@ -202,7 +202,7 @@ bool NetUpsDriver::poll_ups()
_statlen = 0;
Dmsg(20, "Opening connection to %s:%d\n", _hostname, _port);
- if ((_sockfd = net_open(_hostname, NULL, _port)) == INVALID_SOCKET) {
+ if ((_sockfd = net_open(_hostname, NULL, _port)) < 0) {
Dmsg(90, "Exit poll_ups 0 comm lost\n");
if (!_ups->is_commlost()) {
_ups->set_commlost();
diff -up apcupsd-3.14.13/src/lib/statmgr.cpp.netopenfix apcupsd-3.14.13/src/lib/statmgr.cpp
--- apcupsd-3.14.13/src/lib/statmgr.cpp.netopenfix 2015-11-23 13:08:48.076501913 +0100
+++ apcupsd-3.14.13/src/lib/statmgr.cpp 2015-11-23 13:08:48.105502218 +0100
@@ -199,12 +199,12 @@ bool StatMgr::open()
close();
m_socket = net_open(m_host, NULL, m_port);
- return m_socket != INVALID_SOCKET;
+ return m_socket >= 0;
}
void StatMgr::close()
{
- if (m_socket != INVALID_SOCKET) {
+ if (m_socket != INVALID_SOCKET && m_socket >= 0) {
net_close(m_socket);
m_socket = INVALID_SOCKET;
}

View file

@ -1,16 +0,0 @@
diff -up apcupsd-3.14.8/src/Makefile.cxxld apcupsd-3.14.8/src/Makefile
--- apcupsd-3.14.8/src/Makefile.cxxld 2009-09-30 01:20:45.000000000 +0200
+++ apcupsd-3.14.8/src/Makefile 2010-09-22 11:18:03.550601657 +0200
@@ -26,10 +26,10 @@ SRCS = $(common_srcs) $(apcupsd_srcs) $(
all-targets: apcupsd apcaccess apctest smtp
apcupsd: $(common_obj) $(apcupsd_obj) $(APCDRVLIBS) $(APCLIBS)
- $(LINK) $(DRVLIBS)
+ $(LINK) -lstdc++ $(DRVLIBS)
apctest: $(common_obj) $(apctest_obj) $(APCDRVLIBS) $(APCLIBS)
- $(LINK) $(DRVLIBS)
+ $(LINK) -lstdc++ $(DRVLIBS)
apcaccess: $(apcaccess_obj) $(APCLIBS)
$(LINK)

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
Name: apcupsd
Version: 3.14.12
Release: 3%{?dist}
Version: 3.14.13
Release: 2%{?dist}
Summary: APC UPS Power Control Daemon for Linux
Group: System Environment/Daemons
@ -9,24 +9,21 @@ URL: http://www.apcupsd.com
Source0: http://downloads.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
Source1: apcupsd.logrotate
Source2: apcupsd-httpd.conf
Source3: apcupsd64x64.png
Patch0: apcupsd-3.14.3-init.patch
Patch1: apcupsd-3.14.4-shutdown.patch
#fix FTBFS, c++ linking needs -lstdc++ explicitly
Patch2: apcupsd-3.14.8-cxxld.patch
# systemd support
Patch3: apcupsd-3.14.8-systemd.patch
# fix crash in gui, rhbz#578276
Patch4: apcupsd-3.14.9-fixgui.patch
Patch5: apcupsd-aarch64.patch
Patch6: apcupsd-3.14.10-nodbg.patch
Patch5: apcupsd-3.14.13-netopenfix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: glibc-devel >= 2.3, gd-devel > 2.0
BuildRequires: net-snmp-devel, tcp_wrappers-devel
BuildRequires: net-snmp-devel, tcp_wrappers-devel, libusb-devel
BuildRequires: gtk2-devel, gnome-vfs2-devel, desktop-file-utils
Requires: /bin/mail
Requires(post): systemd-units
@ -68,11 +65,9 @@ A GUI interface to the APC UPS monitoring daemon.
%setup -q
%patch0 -p1 -b .init
%patch1 -p1 -b .shutdown
%patch2 -p1 -b .cxxld
%patch3 -p1 -b .systemd
%patch4 -p1 -b .fixgui
%patch5 -p1 -b .aarch64
%patch6 -p1 -b .nodbg
%patch5 -p1 -b .netopenfix
#we will handle fedora/redhat part ourselfs
printf 'install:\n\techo skipped\n' >platforms/redhat/Makefile
@ -93,8 +88,7 @@ export CPPFLAGS="$CPPFLAGS -DNETSNMP_NO_LEGACY_DEFINITIONS"
--enable-net-snmp \
--enable-snmp \
--enable-usb \
--enable-powerflute \
--enable-nls \
--enable-modbus-usb \
--enable-gapcmon \
--enable-pcnet \
--with-libwrap=%{_libdir} \
@ -124,12 +118,14 @@ install -d %{buildroot}%{_sysconfdir}/logrotate.d
install -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -d %{buildroot}%{_sysconfdir}/httpd/conf.d
install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
install -D -m0644 %{SOURCE3} %{buildroot}%{_datadir}/pixmaps/apcupsd64x64.png
desktop-file-install \
%if (0%{?fedora} && 0%{?fedora} < 19) || (0%{?rhel} && 0%{?rhel} < 7)
--vendor="fedora" \
%endif
--dir=${RPM_BUILD_ROOT}%{_datadir}/applications \
--set-icon=apcupsd64x64 \
--delete-original \
${RPM_BUILD_ROOT}%{_datadir}/applications/gapcmon.desktop
@ -173,6 +169,7 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/gapcmon
%{_datadir}/applications/*gapcmon.desktop
%{_datadir}/pixmaps/apcupsd.png
%{_datadir}/pixmaps/apcupsd64x64.png
%{_datadir}/pixmaps/charging.png
%{_datadir}/pixmaps/gapc_prefs.png
%{_datadir}/pixmaps/onbatt.png
@ -191,6 +188,14 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Mon Nov 23 2015 Michal Hlavinka <mhlavink@redhat.com> - 3.14.13-2
- fix apcaccess crash if apcupsd is not running (#1236367,#1197383)
- enabled modbus-usb (#1195071)
- add bigger icon (#1157532)
* Tue Feb 03 2015 Michal Hlavinka <mhlavink@redhat.com> - 3.14.13-1
- apcupsd updated to 3.14.13
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.14.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

0
apcupsd64x64.png Normal file
View file

View file

@ -1 +1 @@
08bf201acea6b4dd69cf2fb0eecfd55e apcupsd-3.14.12.tar.gz
c291d9d3923b4d9c0e600b755ad4f489 apcupsd-3.14.13.tar.gz