src/hotspot/share/classfile/classListParser.cpp
changeset 53261 b7dca420fa0c
parent 52631 3009ca99de32
child 54847 59ea39bb2809
--- a/src/hotspot/share/classfile/classListParser.cpp	Fri Jan 11 13:34:57 2019 +0100
+++ b/src/hotspot/share/classfile/classListParser.cpp	Fri Jan 11 14:05:57 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -47,7 +47,15 @@
   assert(_instance == NULL, "must be singleton");
   _instance = this;
   _classlist_file = file;
-  _file = fopen(file, "r");
+  _file = NULL;
+  // Use os::open() because neither fopen() nor os::fopen()
+  // can handle long path name on Windows.
+  int fd = os::open(file, O_RDONLY, S_IREAD);
+  if (fd != -1) {
+    // Obtain a File* from the file descriptor so that fgets()
+    // can be used in parse_one_line()
+    _file = os::open(fd, "r");
+  }
   if (_file == NULL) {
     char errmsg[JVM_MAXPATHLEN];
     os::lasterror(errmsg, JVM_MAXPATHLEN);