Skip to content

Commit

Permalink
8314883: Java_java_util_prefs_FileSystemPreferences_lockFile0 write r…
Browse files Browse the repository at this point in the history
…esult errno in missing case

Backport-of: 97b94cb1cdeba00f4bba7326a300c0336950f3ec
  • Loading branch information
MBaesken committed Dec 11, 2023
1 parent 0ce4c5e commit d08a3d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/java.prefs/unix/native/libprefs/FileSystemPreferences.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2023, 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
Expand Down Expand Up @@ -71,7 +71,7 @@ Java_java_util_prefs_FileSystemPreferences_lockFile0(JNIEnv *env,
jclass thisclass, jstring java_fname, jint permission, jboolean shared) {
const char *fname = JNU_GetStringPlatformChars(env, java_fname, NULL);
int fd, rc;
int result[2];
int result[2] = {0, 0};
jintArray javaResult = NULL;
int old_umask;
FLOCK fl;
Expand All @@ -90,6 +90,7 @@ Java_java_util_prefs_FileSystemPreferences_lockFile0(JNIEnv *env,

if (shared == JNI_TRUE) {
fd = open(fname, O_RDONLY, 0);
result[1] = errno;
} else {
old_umask = umask(0);
fd = open(fname, O_WRONLY|O_CREAT, permission);
Expand Down

1 comment on commit d08a3d0

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.