fd-util: introduce FDNAME_MAX
This commit is contained in:
+1
-1
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user