diff mbox

Use a separate variable for the size passed to sysctl.

Message ID 1453227896-65820-1-git-send-email-jhb@FreeBSD.org
State New
Headers show

Commit Message

John Baldwin Jan. 19, 2016, 6:24 p.m. UTC
This fixes a sign mismatch warning.

gdb/ChangeLog:

	* fbsd-tdep.c (fbsd_pid_to_exec_file): Use new "buflen" instead of
	"len" with sysctl.
---
 gdb/ChangeLog  | 5 +++++
 gdb/fbsd-nat.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Pedro Alves Jan. 19, 2016, 7:18 p.m. UTC | #1
OK with ...

On 01/19/2016 06:24 PM, John Baldwin wrote:
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,5 +1,10 @@
>  2016-01-19  John Baldwin  <jhb@FreeBSD.org>
>  
> +	* fbsd-tdep.c (fbsd_pid_to_exec_file): Use new "buflen" instead of
> +	"len" with sysctl.

... should be "fbsd-nat.c".

Thanks,
Pedro Alves
diff mbox

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e8277f3..aa7e0fa 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@ 
 2016-01-19  John Baldwin  <jhb@FreeBSD.org>
 
+	* fbsd-tdep.c (fbsd_pid_to_exec_file): Use new "buflen" instead of
+	"len" with sysctl.
+
+2016-01-19  John Baldwin  <jhb@FreeBSD.org>
+
 	* fbsd-tdep.c (find_stop_signal): Remove.
 	(struct fbsd_collect_regset_section_cb) <lwp>: New field.
 	<stop_signal>: New field.
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index d2ec527..6504625 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -48,13 +48,15 @@  fbsd_pid_to_exec_file (struct target_ops *self, int pid)
   char name[PATH_MAX];
 
 #ifdef KERN_PROC_PATHNAME
+  size_t buflen;
   int mib[4];
 
   mib[0] = CTL_KERN;
   mib[1] = KERN_PROC;
   mib[2] = KERN_PROC_PATHNAME;
   mib[3] = pid;
-  if (sysctl (mib, 4, buf, &len, NULL, 0) == 0)
+  buflen = sizeof buf;
+  if (sysctl (mib, 4, buf, &buflen, NULL, 0) == 0)
     return buf;
 #endif