[PATCH] shm_open/unlink: fix errno if namelen >= NAME_MAX
Adhemerval Zanella
adhemerval.zanella@linaro.org
Tue Nov 3 16:43:21 GMT 2020
On 03/11/2020 11:45, Chen Li wrote:
>
> On Mon Oct 26 19:44:44 GMT 2020,
> Adhemerval Zanella wrote:
>
>> I think it would be good to refactor the code to use a PATH_MAX variable
>> instead, something like:
>>
>> _Bool
>> shm_get_name (const char *prefix, char *shm_name, size shm_path_max)
>
> So you prefer function over macro here? If so, shm_dir, shm_dirlen, shm_name
> should all be passed as args too, because unlike c macro, function is not
> dynamical scope. Given such long arg list(errno_for_invalid, retval_for_invalid,
> prefix, shm_dir, shm_dirlen, shm_name), I'm not sure weathre it confrom glibc's
> coding style, and is refactoring to split into more small functions a good idea?
Florian has pointed me out a better solution would be use
use his fix [1] for BZ#25383 [2] which refactor the POSIX sem/shm
code to use a static buffer instead.
Then the ENAMETOOLONG could be returned by '__shm_get_name'
instead.
Florian, do you plan to send your patch for review?
[1] https://sourceware.org/bugzilla/attachment.cgi?id=12921
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=25383
More information about the Libc-alpha
mailing list