[Reproducible-commits] [dpkg] 08/24: s-s-d: Rename sysctl() name variables to mib
Niko Tyni
ntyni at moszumanska.debian.org
Tue May 3 21:38:22 UTC 2016
This is an automated email from the git hooks/post-receive script.
ntyni pushed a commit to branch ntyni/reproducible_builds
in repository dpkg.
commit 7d184c737fde3cb9a02647cfd277a4cd8a7deed3
Author: Guillem Jover <guillem at debian.org>
Date: Tue May 3 19:23:08 2016 +0200
s-s-d: Rename sysctl() name variables to mib
This is the common name used for the first argument, and avoids the
variable name clash with the function argument with the same name.
This fixes a build failure on */kFreeBSD systems.
---
debian/changelog | 3 +++
utils/start-stop-daemon.c | 60 +++++++++++++++++++++++------------------------
2 files changed, 33 insertions(+), 30 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index dc5e97a..938c3c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,9 @@ dpkg (1.18.6) UNRELEASED; urgency=medium
* Use m_strdup() instead of strdup() in dpkg recursive installation code.
* Fix off-by-one array allocation in dpkg recursive installation code that
can cause segfaults.
+ * Rename sysctl() “name” variable to “mib”, to avoid a clash with the
+ call site function argument with the same name in start-stop-daemon.
+ This fixes a build failure on */kFreeBSD systems.
* Packaging:
- Bump Standards-Version to 3.9.8 (no changes needed).
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index f78a29d..da8d8ec 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -1401,17 +1401,17 @@ static bool
pid_is_exec(pid_t pid, const struct stat *esb)
{
struct stat sb;
- int error, name[4];
+ int error, mib[4];
size_t len;
char pathname[PATH_MAX];
- name[0] = CTL_KERN;
- name[1] = KERN_PROC;
- name[2] = KERN_PROC_PATHNAME;
- name[3] = pid;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PATHNAME;
+ mib[3] = pid;
len = sizeof(pathname);
- error = sysctl(name, 4, pathname, &len, NULL, 0);
+ error = sysctl(mib, 4, pathname, &len, NULL, 0);
if (error != 0 && errno != ESRCH)
return false;
if (len == 0)
@@ -1523,15 +1523,15 @@ static bool
pid_is_child(pid_t pid, pid_t ppid)
{
struct kinfo_proc kp;
- int rc, name[4];
+ int rc, mib[4];
size_t len = 0;
- name[0] = CTL_KERN;
- name[1] = KERN_PROC;
- name[2] = KERN_PROC_PID;
- name[3] = pid;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = pid;
- rc = sysctl(name, 4, &kp, &len, NULL, 0);
+ rc = sysctl(mib, 4, &kp, &len, NULL, 0);
if (rc != 0 && errno != ESRCH)
return false;
if (len == 0 || len != sizeof(kp))
@@ -1608,15 +1608,15 @@ static bool
pid_is_user(pid_t pid, uid_t uid)
{
struct kinfo_proc kp;
- int rc, name[4];
+ int rc, mib[4];
size_t len = 0;
- name[0] = CTL_KERN;
- name[1] = KERN_PROC;
- name[2] = KERN_PROC_PID;
- name[3] = pid;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = pid;
- rc = sysctl(name, 4, &kp, &len, NULL, 0);
+ rc = sysctl(mib, 4, &kp, &len, NULL, 0);
if (rc != 0 && errno != ESRCH)
return false;
if (len == 0 || len != sizeof(kp))
@@ -1719,15 +1719,15 @@ static bool
pid_is_cmd(pid_t pid, const char *name)
{
struct kinfo_proc kp;
- int rc, name[4];
+ int rc, mib[4];
size_t len = 0;
- name[0] = CTL_KERN;
- name[1] = KERN_PROC;
- name[2] = KERN_PROC_PID;
- name[3] = pid;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = pid;
- rc = sysctl(name, 4, &kp, &len, NULL, 0);
+ rc = sysctl(mib, 4, &kp, &len, NULL, 0);
if (rc != 0 && errno != ESRCH)
return false;
if (len == 0 || len != sizeof(kp))
@@ -1915,23 +1915,23 @@ static enum status_code
do_procinit(void)
{
struct kinfo_proc *kp;
- int rc, name[3];
+ int rc, mib[3];
size_t len = 0;
int nentries, i;
enum status_code prog_status = STATUS_DEAD;
- name[0] = CTL_KERN;
- name[1] = KERN_PROC;
- name[2] = KERN_PROC_PROC;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PROC;
- rc = sysctl(name, 3, NULL, &len, NULL, 0);
+ rc = sysctl(mib, 3, NULL, &len, NULL, 0);
if (rc != 0 && errno != ESRCH)
return false;
if (len == 0)
return false;
kp = xmalloc(len);
- rc = sysctl(name, 3, kp, &len, NULL, 0);
+ rc = sysctl(mib, 3, kp, &len, NULL, 0);
if (rc != 0 && errno != ESRCH)
return false;
if (len == 0)
--
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