Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff
From: Duy Nguyen <hidden>
Date: 2016-06-16 02:18:42
On Thu, Apr 7, 2016 at 5:11 AM, David Turner [off-list ref] wrote:
quoted hunk ↗ jump to hunk
@@ -1045,4 +1046,21 @@ struct tm *git_gmtime_r(const time_t *, struct tm *); #define getc_unlocked(fh) getc(fh) #endif +#ifdef __linux__ +#define UNIX_PATH_MAX 108 +#elif defined(__APPLE__) || defined(BSD) +#define UNIX_PATH_MAX 104 +#else +/* + * Quoth POSIX: The size of sun_path has intentionally been left + * undefined. This is because different implementations use different + * sizes. For example, 4.3 BSD uses a size of 108, and 4.4 BSD uses a + * size of 104. Since most implementations originate from BSD + * versions, the size is typically in the range 92 to 108. + * + * Thanks, POSIX! Super-helpful! Hope we don't overflow any buffers! + */ +#define UNIX_PATH_MAX 92 +#endif
Okay. You probably want to fix unix-socket.c too, and maybe reuse that code instead of opening unix sockets manually. There's a check in unix_sockaddr_init() about sizeof(sun_path) but I'm not sure if it suffices. BTW, it looks like you tested this on Mac. But config.mak.uname only enables HAVE_SHM on Linux. Should it be enabled on Mac as well at least? -- Duy