Alexey Serbin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/20631 )

Change subject: KUDU-3520 Fix file descriptor leak in encryption
......................................................................


Patch Set 1:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/20631/1/src/kudu/util/env_posix.cc
File src/kudu/util/env_posix.cc:

http://gerrit.cloudera.org:8080/#/c/20631/1/src/kudu/util/env_posix.cc@1569
PS1, Line 1569:         return IOError(fname, errno);
> Also need to close fd when fseek() failed?
+1

Maybe, wrapping the descriptor into a unique_ptr wrapper templated with 
something similar to PosixRWFile but very basic (e.g. PosixAutoClosable with 
just closing the file in the destructor) would be less error-prone and more 
future-proof?  That would require updating existing wrappers to add a move 
constructor that takes PosixAutoClosable as a parameter.


http://gerrit.cloudera.org:8080/#/c/20631/1/src/kudu/util/env_posix.cc@2366
PS1, Line 2366:         RETURN_NOT_OK_EVAL(GenerateHeader(&eh), DoClose(fd));
> Is it better to use SCOPED_CLEANUP instead? Then you don't need to close th
+1

Alternatively, consider the approach with AutoClosableFile wrapper, as 
mentioned in my earlier comment.



--
To view, visit http://gerrit.cloudera.org:8080/20631
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I2412429d4fe836b705296e9e30453d7c4d030cec
Gerrit-Change-Number: 20631
Gerrit-PatchSet: 1
Gerrit-Owner: Attila Bukor <abu...@apache.org>
Gerrit-Reviewer: Alexey Serbin <ale...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Yingchun Lai <laiyingc...@apache.org>
Gerrit-Reviewer: Zoltan Chovan <zcho...@cloudera.com>
Gerrit-Comment-Date: Mon, 30 Oct 2023 17:20:23 +0000
Gerrit-HasComments: Yes

Reply via email to