< prev index next >
src/os/aix/vm/perfMemory_aix.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2013 SAP AG. 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
--- 1,7 ----
/*
! * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2013 SAP AG. 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
*** 452,468 ****
*saved_cwd_fd = -1;
} else {
*saved_cwd_fd = result;
}
! // Set the current directory to dirname by using the fd of the directory.
result = fchdir(fd);
!
return dirp;
}
// Close the directory and restore the current working directory.
static void close_directory_secure_cwd(DIR* dirp, int saved_cwd_fd) {
int result;
// If we have a saved cwd change back to it and close the fd.
if (saved_cwd_fd != -1) {
--- 452,482 ----
*saved_cwd_fd = -1;
} else {
*saved_cwd_fd = result;
}
! // Set the current directory to dirname by using the fd of the directory and
! // handle errors, otherwise shared memory files will be created in cwd.
result = fchdir(fd);
! if (result == OS_ERR) {
! if (PrintMiscellaneous && Verbose) {
! warning("could not change to directory %s", dirname);
! }
! if (*saved_cwd_fd != -1) {
! ::close(*saved_cwd_fd);
! *saved_cwd_fd = -1;
! }
! // Close the directory.
! os::closedir(dirp);
! return NULL;
! } else {
return dirp;
+ }
}
// Close the directory and restore the current working directory.
+ //
static void close_directory_secure_cwd(DIR* dirp, int saved_cwd_fd) {
int result;
// If we have a saved cwd change back to it and close the fd.
if (saved_cwd_fd != -1) {
< prev index next >