答案 0 :(得分:4)
不要修补标题,在自己的文件中定义它。
#ifndef SUN_LEN //In case they fix it down the road
#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen((ptr)->sun_path))
#endif
答案 1 :(得分:0)
SUN_LEN宏是非便携式(也不是POSIX标准的一部分)扩展
使用sizeof(struct sockaddr_un)
代替是完全安全的。