[Reproducible-commits] [dpkg] 34/74: s-s-d: Set return buffer length for sysctl(2) calls on */kFreeBSD

Mattia Rizzolo mattia at debian.org
Sun Jul 3 22:22:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to annotated tag 1.18.8
in repository dpkg.

commit 3bda1e34afefcd5ebd20bde16bdfb9239c433090
Author: Guillem Jover <guillem at debian.org>
Date:   Fri May 20 02:10:31 2016 +0200

    s-s-d: Set return buffer length for sysctl(2) calls on */kFreeBSD
---
 debian/changelog          | 2 ++
 utils/start-stop-daemon.c | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 6e54e77..356e12c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
   * Add new dpkg-source --no-overwrite-dir extraction option. Closes: #826334
   * Fix number of entries computation returned by sysctl() on */kFreeBSD in
     start-stop-daemon.
+  * Set return buffer length for sysctl(2) calls on */kFreeBSD in
+    start-stop-daemon.
   * Perl modules:
     - Use warnings::warnif() instead of carp() for deprecated warnings.
     - Add new format_range() method and deprecate dpkg() and rfc822() methods
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 080e3f3..7ff30ea 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -1524,12 +1524,13 @@ pid_is_child(pid_t pid, pid_t ppid)
 {
 	struct kinfo_proc kp;
 	int rc, mib[4];
-	size_t len = 0;
+	size_t len;
 
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_PROC;
 	mib[2] = KERN_PROC_PID;
 	mib[3] = pid;
+	len = sizeof(kp);
 
 	rc = sysctl(mib, 4, &kp, &len, NULL, 0);
 	if (rc != 0 && errno != ESRCH)
@@ -1609,12 +1610,13 @@ pid_is_user(pid_t pid, uid_t uid)
 {
 	struct kinfo_proc kp;
 	int rc, mib[4];
-	size_t len = 0;
+	size_t len;
 
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_PROC;
 	mib[2] = KERN_PROC_PID;
 	mib[3] = pid;
+	len = sizeof(kp);
 
 	rc = sysctl(mib, 4, &kp, &len, NULL, 0);
 	if (rc != 0 && errno != ESRCH)
@@ -1720,12 +1722,13 @@ pid_is_cmd(pid_t pid, const char *name)
 {
 	struct kinfo_proc kp;
 	int rc, mib[4];
-	size_t len = 0;
+	size_t len;
 
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_PROC;
 	mib[2] = KERN_PROC_PID;
 	mib[3] = pid;
+	len = sizeof(kp);
 
 	rc = sysctl(mib, 4, &kp, &len, NULL, 0);
 	if (rc != 0 && errno != ESRCH)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list