< prev index next >
src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c
Print this page
rev 13166 : read/write APIs in class os shall return ssize_t
*** 1,7 ****
/*
! * Copyright (c) 2003, 2013, 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.
--- 1,7 ----
/*
! * Copyright (c) 2003, 2017, 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.
*** 821,839 ****
if (add_map_info(ph, ph->core->exec_fd, exec_php->p_offset, exec_php->p_vaddr, exec_php->p_filesz) == NULL) goto err;
}
break;
}
! // read the interpreter and it's segments
case PT_INTERP: {
char interp_name[BUF_SIZE + 1];
// BUF_SIZE is PATH_MAX + NAME_MAX + 1.
if (exec_php->p_filesz > BUF_SIZE) {
goto err;
}
! pread(ph->core->exec_fd, interp_name, exec_php->p_filesz, exec_php->p_offset);
interp_name[exec_php->p_filesz] = '\0';
print_debug("ELF interpreter %s\n", interp_name);
// read interpreter segments as well
if ((ph->core->interp_fd = pathmap_open(interp_name)) < 0) {
print_debug("can't open runtime loader\n");
--- 821,844 ----
if (add_map_info(ph, ph->core->exec_fd, exec_php->p_offset, exec_php->p_vaddr, exec_php->p_filesz) == NULL) goto err;
}
break;
}
! // read the interpreter and its segments
case PT_INTERP: {
+ ssize_t res;
char interp_name[BUF_SIZE + 1];
// BUF_SIZE is PATH_MAX + NAME_MAX + 1.
if (exec_php->p_filesz > BUF_SIZE) {
goto err;
}
! res = pread(ph->core->exec_fd, interp_name, exec_php->p_filesz, exec_php->p_offset);
! if (res < 0) {
! print_debug("couldn't read ELF interpreter name\n");
! goto err;
! }
interp_name[exec_php->p_filesz] = '\0';
print_debug("ELF interpreter %s\n", interp_name);
// read interpreter segments as well
if ((ph->core->interp_fd = pathmap_open(interp_name)) < 0) {
print_debug("can't open runtime loader\n");
< prev index next >