Re: [PATCH 2/8] unix-socket: stub impl. for platforms with no unix socket support
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- May 13, 2014, 12:03 UTC
- Message-ID
- <CABPQNSayUdjgby7Pp7rGD0Vn9qb7rGOXfC8neM-4g-Lu7aAQzw@mail.gmail.com>
- In-Reply-To
- <CABPQNSZAxyWJucyJbO0ND2X5V+cnCFCGLZPfFhygi2tUVQCXYg@mail.gmail.com>
On Tue, May 13, 2014 at 1:59 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
Show 56 quoted lines
> On Tue, May 13, 2014 at 1:15 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
>> With this we can make unix_stream_* calls without #ifdef.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>> Makefile | 2 ++
>> unix-socket.h | 18 ++++++++++++++++++
>> 2 files changed, 20 insertions(+)
>>
>> diff --git a/Makefile b/Makefile
>> index 028749b..d0a2b4b 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -1417,6 +1417,8 @@ ifndef NO_UNIX_SOCKETS
>> LIB_H += unix-socket.h
>> PROGRAM_OBJS += credential-cache.o
>> PROGRAM_OBJS += credential-cache--daemon.o
>> +else
>> + BASIC_CFLAGS += -DNO_UNIX_SOCKETS
>> endif
>>
>> ifdef NO_ICONV
>> diff --git a/unix-socket.h b/unix-socket.h
>> index e271aee..f1cba70 100644
>> --- a/unix-socket.h
>> +++ b/unix-socket.h
>> @@ -1,7 +1,25 @@
>> #ifndef UNIX_SOCKET_H
>> #define UNIX_SOCKET_H
>>
>> +#ifndef NO_UNIX_SOCKETS
>> +
>> int unix_stream_connect(const char *path);
>> int unix_stream_listen(const char *path);
>>
>> +#else
>> +
>> +static inline int unix_stream_connect(const char *path)
>> +{
>> + errno = ENOSYS;
>> + return -1;
>> +}
>> +
>> +static inline int unix_stream_listen(const char *path)
>> +{
>> + errno = ENOSYS;
>> + return -1;
>> +}
>> +
>> +#endif
>> +
>> #endif /* UNIX_SOCKET_H */
>
> OK, so I missed this before my other two comments. But still... in
> what way does errno=ENOSYS make this *work*? Won't we end up compiling
> lots of non-functional tools on Windows in this case?ENOSYS makes git-credential-cache.c just die with the message "unable to start cache daemon", and git-credential--daemon.c die with "unable to bind to <socket_path>".