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

Reviewed-by: jpai, shade, vtewari
  • Loading branch information
MBaesken committed Aug 24, 2023
1 parent 75e19e0 commit 97b94cb
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

0 comments on commit 97b94cb

Please sign in to comment.