equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
859 return realpath(buffer, _exePath); |
859 return realpath(buffer, _exePath); |
860 } |
860 } |
861 |
861 |
862 char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { |
862 char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { |
863 if (str != NULL) { |
863 if (str != NULL) { |
864 size_t len = strlen(str); |
864 return os::strdup_check_oom(str, mtInternal); |
865 char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal); |
|
866 strncpy(tmp, str, len); |
|
867 tmp[len] = '\0'; |
|
868 return tmp; |
|
869 } |
865 } |
870 return NULL; |
866 return NULL; |
871 } |
867 } |
872 |
868 |
873 int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProcess* process_info) { |
869 int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProcess* process_info) { |