From: Yu Watanabe Date: Wed, 12 May 2021 01:19:19 +0000 (+0900) Subject: fd-util: introduce FDNAME_MAX X-Git-Tag: v249-rc1~243^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ae3f4bae686966b5e1595191c3b9b8f6d1b6e954;p=thirdparty%2Fsystemd.git fd-util: introduce FDNAME_MAX --- diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index d63f012ad51..1a873601b27 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -454,7 +454,7 @@ bool fdname_is_valid(const char *s) { return false; } - return p - s < 256; + return p - s <= FDNAME_MAX; } int fd_get_path(int fd, char **ret) { diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h index f05c2b5a15d..aa8e082b38d 100644 --- a/src/basic/fd-util.h +++ b/src/basic/fd-util.h @@ -8,6 +8,9 @@ #include "macro.h" +/* maximum length of fdname */ +#define FDNAME_MAX 255 + /* Make sure we can distinguish fd 0 and NULL */ #define FD_TO_PTR(fd) INT_TO_PTR((fd)+1) #define PTR_TO_FD(p) (PTR_TO_INT(p)-1)