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,7 +160,8 @@ def own_socketfile(milterconfig):
|
|||||||
offset = 5
|
offset = 5
|
||||||
|
|
||||||
if offset is not None:
|
if offset is not None:
|
||||||
os.chown(sockname[offset:], user, group)
|
if os.path.exists(sockname[offset:]):
|
||||||
|
os.chown(sockname[offset:], user, group)
|
||||||
|
|
||||||
|
|
||||||
def read_keyfile(milterconfig, keytype):
|
def read_keyfile(milterconfig, keytype):
|
||||||
|
|||||||
Reference in New Issue
Block a user