do not call malloc and sysctl twice that was introduced by a bad copy & paste
diff from Caspar Schutijser
This commit is contained in:
parent
90f4904171
commit
2d6929e113
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.326 2017/06/25 21:53:56 robert Exp $
|
||||
# $OpenBSD: Makefile,v 1.327 2017/06/26 17:16:30 robert Exp $
|
||||
|
||||
USE_WXNEEDED= Yes
|
||||
|
||||
@ -8,6 +8,7 @@ DPB_PROPERTIES= parallel
|
||||
COMMENT= Chromium browser
|
||||
|
||||
V= 59.0.3071.109
|
||||
REVISION= 0
|
||||
|
||||
DISTNAME= chromium-${V}
|
||||
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
|
||||
|
@ -1,6 +1,7 @@
|
||||
$OpenBSD: patch-base_process_process_handle_openbsd_cc,v 1.2 2016/03/06 10:51:13 robert Exp $
|
||||
--- base/process/process_handle_openbsd.cc.orig.port Thu Mar 3 09:47:09 2016
|
||||
+++ base/process/process_handle_openbsd.cc Thu Mar 3 09:49:15 2016
|
||||
$OpenBSD: patch-base_process_process_handle_openbsd_cc,v 1.3 2017/06/26 17:16:30 robert Exp $
|
||||
Index: base/process/process_handle_openbsd.cc
|
||||
--- base/process/process_handle_openbsd.cc.orig
|
||||
+++ base/process/process_handle_openbsd.cc
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "base/process/process_handle.h"
|
||||
|
||||
@ -10,7 +11,7 @@ $OpenBSD: patch-base_process_process_handle_openbsd_cc,v 1.2 2016/03/06 10:51:13
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
@@ -13,39 +15,64 @@
|
||||
@@ -13,39 +15,59 @@
|
||||
namespace base {
|
||||
|
||||
ProcessId GetParentProcessId(ProcessHandle process) {
|
||||
@ -24,23 +25,18 @@ $OpenBSD: patch-base_process_process_handle_openbsd_cc,v 1.2 2016/03/06 10:51:13
|
||||
if (sysctl(mib, arraysize(mib), NULL, &length, NULL, 0) < 0)
|
||||
return -1;
|
||||
|
||||
- mib[5] = (length / sizeof(struct kinfo_proc));
|
||||
+ info = (struct kinfo_proc *)malloc(length);
|
||||
+
|
||||
mib[5] = (length / sizeof(struct kinfo_proc));
|
||||
|
||||
- if (sysctl(mib, arraysize(mib), &info, &length, NULL, 0) < 0)
|
||||
+ if (sysctl(mib, arraysize(mib), NULL, &length, NULL, 0) < 0)
|
||||
return -1;
|
||||
|
||||
- return info.p_ppid;
|
||||
+ info = (struct kinfo_proc *)malloc(length);
|
||||
+
|
||||
+ mib[5] = (length / sizeof(struct kinfo_proc));
|
||||
+
|
||||
- return -1;
|
||||
+ if (sysctl(mib, arraysize(mib), info, &length, NULL, 0) < 0) {
|
||||
+ ppid = -1;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
|
||||
- return info.p_ppid;
|
||||
+ ppid = info->p_ppid;
|
||||
+
|
||||
+out:
|
||||
|
Loading…
x
Reference in New Issue
Block a user