Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jdk17u
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
openjdk
jdk17u
Commits
df45a1b5
Commit
df45a1b5
authored
Jul 17, 2018
by
Alan Bateman
Browse files
Options
Downloads
Patches
Plain Diff
8207340: (fs) UnixNativeDispatcher close and readdir usages should be fixed
Reviewed-by: bpb
parent
a376d5da
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
+25
-35
25 additions, 35 deletions
src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
with
25 additions
and
35 deletions
src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
+
25
−
35
View file @
df45a1b5
/*
* Copyright (c) 2008, 201
7
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
8
, 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
...
...
@@ -72,7 +72,7 @@
#define fstat64 fstat
#define lstat64 lstat
#define dirent64 dirent
#define readdir64
_r
readdir
_r
#define readdir64 readdir
#endif
#include
"jni.h"
...
...
@@ -425,9 +425,17 @@ Java_sun_nio_fs_UnixNativeDispatcher_openat0(JNIEnv* env, jclass this, jint dfd,
JNIEXPORT
void
JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_close0
(
JNIEnv
*
env
,
jclass
this
,
jint
fd
)
{
int
err
;
/* TDB - need to decide if EIO and other errors should cause exception */
RESTARTABLE
(
close
((
int
)
fd
),
err
);
int
res
;
#if defined(_AIX)
/* AIX allows close to be restarted after EINTR */
RESTARTABLE
(
close
((
int
)
fd
),
res
);
#else
res
=
close
((
int
)
fd
);
#endif
if
(
res
==
-
1
&&
errno
!=
EINTR
)
{
throwUnixException
(
env
,
errno
);
}
}
JNIEXPORT
jint
JNICALL
...
...
@@ -720,32 +728,15 @@ Java_sun_nio_fs_UnixNativeDispatcher_closedir(JNIEnv* env, jclass this, jlong di
JNIEXPORT
jbyteArray
JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_readdir
(
JNIEnv
*
env
,
jclass
this
,
jlong
value
)
{
struct
dirent64
*
result
;
struct
{
struct
dirent64
buf
;
char
name_extra
[
PATH_MAX
+
1
-
sizeof
result
->
d_name
];
}
entry
;
struct
dirent64
*
ptr
=
&
entry
.
buf
;
int
res
;
DIR
*
dirp
=
jlong_to_ptr
(
value
);
struct
dirent64
*
ptr
;
/* EINTR not listed as a possible error */
/* TDB: reentrant version probably not required here */
res
=
readdir64_r
(
dirp
,
ptr
,
&
result
);
#ifdef _AIX
/* On AIX, readdir_r() returns EBADF (i.e. '9') and sets 'result' to NULL for the */
/* directory stream end. Otherwise, 'errno' will contain the error code. */
if
(
res
!=
0
)
{
res
=
(
result
==
NULL
&&
res
==
EBADF
)
?
0
:
errno
;
errno
=
0
;
ptr
=
readdir64
(
dirp
);
if
(
ptr
==
NULL
)
{
if
(
errno
!=
0
)
{
throwUnixException
(
env
,
errno
);
}
#endif
if
(
res
!=
0
)
{
throwUnixException
(
env
,
res
);
return
NULL
;
}
else
{
if
(
result
==
NULL
)
{
return
NULL
;
}
else
{
jsize
len
=
strlen
(
ptr
->
d_name
);
...
...
@@ -756,7 +747,6 @@ Java_sun_nio_fs_UnixNativeDispatcher_readdir(JNIEnv* env, jclass this, jlong val
return
bytes
;
}
}
}
JNIEXPORT
void
JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_mkdir0
(
JNIEnv
*
env
,
jclass
this
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment