Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Apr 8, 2016, 11:26 UTC
- Message-ID
- <CACsJy8C5NhaAAW=wzpwkBdLvVZz8wVM7QX==n_CL5g+LLAKY=A@mail.gmail.com>
- In-Reply-To
- <1459980722-4836-4-git-send-email-dturner@twopensource.com>
On Thu, Apr 7, 2016 at 5:11 AM, David Turner <dturner@twopensource.com> wrote:
Show 20 quoted lines
> @@ -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