On 26/01/2021 14:06, Rémy Maucherat wrote: > On Tue, Jan 26, 2021 at 2:56 PM <ma...@apache.org> wrote: > >> This is an automated email from the ASF dual-hosted git repository. >> >> markt pushed a commit to branch 9.0.x >> in repository https://gitbox.apache.org/repos/asf/tomcat.git >> >> >> The following commit(s) were added to refs/heads/9.0.x by this push: >> new 9ebeda2 Fix a SpotBugs warning - log an message when permission >> setting fails >> 9ebeda2 is described below >> >> commit 9ebeda2df488803d61b371c0cc36db83fe04f197 >> Author: Mark Thomas <ma...@apache.org> >> AuthorDate: Tue Jan 26 13:54:52 2021 +0000 >> >> Fix a SpotBugs warning - log an message when permission setting fails >> > > Actually, the "else" seems useless at the moment and should be dropped > altogether.
I can do that as I am in the area. Worth logging if attrs is null? Mark > > Rémy > > >> --- >> java/org/apache/tomcat/util/net/LocalStrings.properties | 3 +++ >> java/org/apache/tomcat/util/net/NioEndpoint.java | 12 +++++++++--- >> 2 files changed, 12 insertions(+), 3 deletions(-) >> >> diff --git a/java/org/apache/tomcat/util/net/LocalStrings.properties >> b/java/org/apache/tomcat/util/net/LocalStrings.properties >> index bcf697c..257f4bf 100644 >> --- a/java/org/apache/tomcat/util/net/LocalStrings.properties >> +++ b/java/org/apache/tomcat/util/net/LocalStrings.properties >> @@ -97,6 +97,9 @@ endpoint.nio.keyProcessingError=Error processing >> selection key >> endpoint.nio.latchMustBeZero=Latch must be at count zero or null >> endpoint.nio.nullLatch=Latch cannot be null >> endpoint.nio.nullSocketChannel=Invalid null socket channel while >> processing poller event >> +endpoint.nio.perms.execFail=Failed to set execute permissions for Unix >> domain socket [{0}] >> +endpoint.nio.perms.readFail=Failed to set read permissions for Unix >> domain socket [{0}] >> +endpoint.nio.perms.writeFail=Failed to set write permissions for Unix >> domain socket [{0}] >> endpoint.nio.pollerEventError=Error processing poller event >> endpoint.nio.registerFail=Failed to register socket with selector from >> poller >> endpoint.nio.selectorCloseFail=Failed to close selector when closing the >> poller >> diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java >> b/java/org/apache/tomcat/util/net/NioEndpoint.java >> index 4ccfd4f..86e377d 100644 >> --- a/java/org/apache/tomcat/util/net/NioEndpoint.java >> +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java >> @@ -272,9 +272,15 @@ public class NioEndpoint extends >> AbstractJsseEndpoint<NioChannel,SocketChannel> >> Files.setAttribute(path, attrs.name(), >> attrs.value()); >> } else { >> java.io.File file = path.toFile(); >> - file.setReadable(true, false); >> - file.setWritable(true, false); >> - file.setExecutable(false, false); >> + if (!file.setReadable(true, false)) { >> + >> log.warn(sm.getString("endpoint.nio.perms.readFail", path)); >> + } >> + if (!file.setWritable(true, false)) { >> + >> log.warn(sm.getString("endpoint.nio.perms.writeFail", path)); >> + } >> + if (!file.setExecutable(false, false)) { >> + >> log.warn(sm.getString("endpoint.nio.perms.execFail", path)); >> + } >> } >> } >> } else { >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: dev-h...@tomcat.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org