nshlib/nsh_fsutils.c: fix getpid_callback function read size

Commit 5330966 replaced local static buffer with malloc allocated
lib_get_pathbuffer. This however prevents the usage of sizeof(buffer)
in the follow up read function, therefore the read size has to be
specified as PATH_MAX - 1.

This fixes the functionality of pidof function call (and subsequently
pkill call that uses pidof).

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc
2025-03-26 16:49:34 +01:00
committed by archer
parent 940ee9385c
commit 0640d3f550

View File

@@ -98,7 +98,7 @@ static int getpid_callback(FAR struct nsh_vtbl_s *vtbl,
return 0;
}
len = read(fd, buffer, sizeof(buffer) - 1);
len = read(fd, buffer, PATH_MAX - 1);
close(fd);
if (len < 0)
{