Avoid failing to chown non-existent Unix-domain sockets
Changing ownership of sockets that doesn't exist isn't a great practice. A better approach would be to apply os.chown() to the file descriptor of the open socket, but at the very least dkimpy-milter shouldn't crash the way it currently does if the socket isn't already present.
This commit is contained in:
@@ -160,6 +160,7 @@ def own_socketfile(milterconfig):
|
||||
offset = 5
|
||||
|
||||
if offset is not None:
|
||||
if os.path.exists(sockname[offset:]):
|
||||
os.chown(sockname[offset:], user, group)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user