Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 321788 Details for
Bug 408893
app-admin/conky-1.8.1-r4 USE=apcupsd shows N/A in the output
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix broken apcups support in >Conky 1.8.0
fix-apcupsd.patch (text/plain), 2.80 KB, created by
Machredsch
on 2012-08-20 19:30:12 UTC
(
hide
)
Description:
Fix broken apcups support in >Conky 1.8.0
Filename:
MIME Type:
Creator:
Machredsch
Created:
2012-08-20 19:30:12 UTC
Size:
2.80 KB
patch
obsolete
>Description: Fix broken apcupsd support in Conky 1.8.1 > Revert apcupsd-related code to Conky 1.8.0 in order to fix broken apcupsd > support. This is a workaround until upstream properly addresses this issue. >From: Brian Derr <bderrly@gmail.com> >Forwarded: http://sourceforge.net/support/tracker.php?aid=3083859 >Bug-Ubuntu: https://bugs.launchpad.net/bugs/897495 >Last-Update: 2011-12-02 > >--- a/src/apcupsd.c >+++ b/src/apcupsd.c >@@ -154,7 +154,7 @@ > // > // Conky update function for apcupsd data > // >-int update_apcupsd(void) { >+void update_apcupsd(void) { > > int i; > APCUPSD_S apc; >@@ -164,41 +164,44 @@ > memcpy(apc.items[i], "N/A", 4); // including \0 > > do { >- struct addrinfo hints; >- struct addrinfo *ai, *rp; >- int res; >+ struct hostent* he = 0; >+ struct sockaddr_in addr; > short sz = 0; >- char portbuf[8]; >+#ifdef HAVE_GETHOSTBYNAME_R >+ struct hostent he_mem; >+ int he_errno; >+ char hostbuff[2048]; >+#endif > // > // connect to apcupsd daemon > // >- memset(&hints, 0, sizeof(struct addrinfo)); >- hints.ai_family = AF_UNSPEC; >- hints.ai_socktype = SOCK_STREAM; >- hints.ai_flags = 0; >- hints.ai_protocol = 0; >- snprintf(portbuf, 8, "%d", info.apcupsd.port); >- res = getaddrinfo(info.apcupsd.host, portbuf, &hints, &ai); >- if (res != 0) { >- NORM_ERR("APCUPSD getaddrinfo: %s", gai_strerror(res)); >+ sock = socket(AF_INET, SOCK_STREAM, 0); >+ if (sock < 0) { >+ perror("socket"); > break; > } >- for (rp = ai; rp != NULL; rp = rp->ai_next) { >- sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); >- if (sock == -1) { >- continue; >- } >- if (connect(sock, rp->ai_addr, rp->ai_addrlen) != -1) { >- break; >- } >- close(sock); >+#ifdef HAVE_GETHOSTBYNAME_R >+ if (gethostbyname_r(info.apcupsd.host, &he_mem, hostbuff, sizeof(hostbuff), &he, &he_errno) || !he ) { >+ NORM_ERR("APCUPSD gethostbyname_r: %s", hstrerror(h_errno)); >+ break; >+ } >+#else /* HAVE_GETHOSTBYNAME_R */ >+ he = gethostbyname(info.apcupsd.host); >+ if (!he) { >+ herror("gethostbyname"); >+ break; > } >- freeaddrinfo(ai); >- if (rp == NULL) { >+#endif /* HAVE_GETHOSTBYNAME_R */ >+ >+ memset(&addr, 0, sizeof(addr)); >+ addr.sin_family = AF_INET; >+ addr.sin_port = info.apcupsd.port; >+ memcpy(&addr.sin_addr, he->h_addr, he->h_length); >+ if (connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr)) < 0) { > // no error reporting, the daemon is probably not running > break; > } >- >+ > // > // send status request - "status" - 6B > // >@@ -222,5 +225,5 @@ > // "atomically" copy the data into working set > // > memcpy(info.apcupsd.items, apc.items, sizeof(info.apcupsd.items)); >- return 0; >+ return; > } >--- a/src/apcupsd.h >+++ b/src/apcupsd.h >@@ -49,6 +49,6 @@ > } APCUPSD_S, *PAPCUPSD_S; > > /* Service routine for the conky main thread */ >-int update_apcupsd(void); >+void update_apcupsd(void); > > #endif /*APCUPSD_H_*/
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 408893
: 321788