src/os/bsd/dtrace/jvm_dtrace.c
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -225,11 +225,11 @@
}
/* attach to given JVM */
jvm_t* jvm_attach(pid_t pid) {
jvm_t* jvm;
- int door_fd, attach_fd, i;
+ int door_fd, attach_fd, i = 0;
jvm = (jvm_t*) calloc(1, sizeof(jvm_t));
if (jvm == NULL) {
set_jvm_error(JVM_ERR_OUT_OF_MEMORY);
print_debug("calloc failed in %s at %d\n", __FILE__, __LINE__);
@@ -290,18 +290,17 @@
}
/* detach the givenb JVM */
int jvm_detach(jvm_t* jvm) {
if (jvm) {
- int res;
+ int res = 0;
if (jvm->door_fd != -1) {
if (file_close(jvm->door_fd) != 0) {
set_jvm_error(JVM_ERR_CANT_CLOSE_DOOR);
res = -1;
} else {
clear_jvm_error();
- res = 0;
}
}
free(jvm);
return res;
} else {