Fix a bug in code I've added to Konsole some time ago that resulted in
superflows errors in .xsession-errors. Reminded by STeve Andre' on ports@, thanks!
This commit is contained in:
parent
87da714083
commit
9f0abb0db3
@ -1,9 +1,8 @@
|
||||
# $OpenBSD: Makefile,v 1.4 2013/12/08 19:13:31 zhuk Exp $
|
||||
# $OpenBSD: Makefile,v 1.5 2014/01/27 10:23:40 zhuk Exp $
|
||||
|
||||
COMMENT = KDE terminal emulator
|
||||
DISTNAME = konsole-${MODKDE4_VERSION}
|
||||
|
||||
# Check that sysctl() really could return EAGAIN (OpenBSDProcessInfo).
|
||||
REVISION = 0
|
||||
|
||||
SHARED_LIBS = kdeinit4_konsole 51.0
|
||||
SHARED_LIBS += konsoleprivate 51.0
|
||||
|
29
x11/kde4/konsole/patches/patch-src_ProcessInfo_cpp
Normal file
29
x11/kde4/konsole/patches/patch-src_ProcessInfo_cpp
Normal file
@ -0,0 +1,29 @@
|
||||
$OpenBSD: patch-src_ProcessInfo_cpp,v 1.1 2014/01/27 10:23:40 zhuk Exp $
|
||||
Fix sysctl(3) error handling.
|
||||
--- src/ProcessInfo.cpp.orig Mon Jan 27 14:10:44 2014
|
||||
+++ src/ProcessInfo.cpp Mon Jan 27 14:15:43 2014
|
||||
@@ -781,7 +781,7 @@ class OpenBSDProcessInfo : public UnixProcessInfo (pri
|
||||
managementInfoBase[2] = aPid;
|
||||
managementInfoBase[3] = whatMib;
|
||||
|
||||
- do {
|
||||
+ while (true) {
|
||||
len *= 2;
|
||||
nbuf = realloc(buf, len);
|
||||
if (nbuf == NULL) {
|
||||
@@ -790,8 +790,13 @@ class OpenBSDProcessInfo : public UnixProcessInfo (pri
|
||||
|
||||
buf = nbuf;
|
||||
rc = ::sysctl(managementInfoBase, 4, buf, &len, NULL, 0);
|
||||
- kWarning() << "sysctl() call failed with code" << errno;
|
||||
- } while (rc == -1 && errno == ENOMEM);
|
||||
+ if (rc != -1) {
|
||||
+ break;
|
||||
+ } else if (errno != ENOMEM) {
|
||||
+ kWarning() << "sysctl() call failed with code" << errno;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if (nbuf == NULL || rc == -1) {
|
||||
free(buf);
|
Loading…
Reference in New Issue
Block a user