src/hotspot/share/classfile/classListParser.cpp
changeset 53261 b7dca420fa0c
parent 52631 3009ca99de32
child 54847 59ea39bb2809
equal deleted inserted replaced
53260:fbc921683f02 53261:b7dca420fa0c
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 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.
    45 
    45 
    46 ClassListParser::ClassListParser(const char* file) {
    46 ClassListParser::ClassListParser(const char* file) {
    47   assert(_instance == NULL, "must be singleton");
    47   assert(_instance == NULL, "must be singleton");
    48   _instance = this;
    48   _instance = this;
    49   _classlist_file = file;
    49   _classlist_file = file;
    50   _file = fopen(file, "r");
    50   _file = NULL;
       
    51   // Use os::open() because neither fopen() nor os::fopen()
       
    52   // can handle long path name on Windows.
       
    53   int fd = os::open(file, O_RDONLY, S_IREAD);
       
    54   if (fd != -1) {
       
    55     // Obtain a File* from the file descriptor so that fgets()
       
    56     // can be used in parse_one_line()
       
    57     _file = os::open(fd, "r");
       
    58   }
    51   if (_file == NULL) {
    59   if (_file == NULL) {
    52     char errmsg[JVM_MAXPATHLEN];
    60     char errmsg[JVM_MAXPATHLEN];
    53     os::lasterror(errmsg, JVM_MAXPATHLEN);
    61     os::lasterror(errmsg, JVM_MAXPATHLEN);
    54     vm_exit_during_initialization("Loading classlist failed", errmsg);
    62     vm_exit_during_initialization("Loading classlist failed", errmsg);
    55   }
    63   }