aboutsummaryrefslogtreecommitdiff
path: root/gdb/fbsd-nat.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2016-01-19 10:23:00 -0800
committerJohn Baldwin <jhb@FreeBSD.org>2016-01-19 11:35:19 -0800
commitf2feec9809edbeeee0bb5b036e4ae25f9c37cd14 (patch)
tree623f783a121511bfe8aa27e40242acced85ed5d6 /gdb/fbsd-nat.c
parent40068dccc4f9c86cb9e7c425c4ab3e272312affb (diff)
downloadgdb-f2feec9809edbeeee0bb5b036e4ae25f9c37cd14.zip
gdb-f2feec9809edbeeee0bb5b036e4ae25f9c37cd14.tar.gz
gdb-f2feec9809edbeeee0bb5b036e4ae25f9c37cd14.tar.bz2
Use a separate variable for the size passed to sysctl.
This fixes a sign mismatch warning. gdb/ChangeLog: * fbsd-nat.c (fbsd_pid_to_exec_file): Use new "buflen" instead of "len" with sysctl.
Diffstat (limited to 'gdb/fbsd-nat.c')
-rw-r--r--gdb/fbsd-nat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index d2ec527..e7ca0e6 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -43,18 +43,20 @@
static char *
fbsd_pid_to_exec_file (struct target_ops *self, int pid)
{
- ssize_t len = PATH_MAX;
+ ssize_t len;
static char buf[PATH_MAX];
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