diff options
author | Koki Saito <49419225+saito828koki@users.noreply.github.com> | 2022-10-03 00:41:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 00:41:01 (GMT) |
commit | 19ca114645bd8796cf4094e152b1fa9944da473d (patch) | |
tree | b29d4dbc8ece5be4a1e2380fda58e2372bd63259 /Lib/multiprocessing/resource_tracker.py | |
parent | 14d4f68ebb495fe7ccbaf283386d861a054d8288 (diff) | |
download | cpython-19ca114645bd8796cf4094e152b1fa9944da473d.zip cpython-19ca114645bd8796cf4094e152b1fa9944da473d.tar.gz cpython-19ca114645bd8796cf4094e152b1fa9944da473d.tar.bz2 |
gh-96819: multiprocessing.resource_tracker: check if length of pipe write <= 512 (#96890)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Diffstat (limited to 'Lib/multiprocessing/resource_tracker.py')
-rw-r--r-- | Lib/multiprocessing/resource_tracker.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/multiprocessing/resource_tracker.py b/Lib/multiprocessing/resource_tracker.py index cc42dbd..ea36950 100644 --- a/Lib/multiprocessing/resource_tracker.py +++ b/Lib/multiprocessing/resource_tracker.py @@ -161,10 +161,10 @@ class ResourceTracker(object): def _send(self, cmd, name, rtype): self.ensure_running() msg = '{0}:{1}:{2}\n'.format(cmd, name, rtype).encode('ascii') - if len(name) > 512: + if len(msg) > 512: # posix guarantees that writes to a pipe of less than PIPE_BUF # bytes are atomic, and that PIPE_BUF >= 512 - raise ValueError('name too long') + raise ValueError('msg too long') nbytes = os.write(self._fd, msg) assert nbytes == len(msg), "nbytes {0:n} but len(msg) {1:n}".format( nbytes, len(msg)) |