diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-07-03 03:57:55 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-07-06 11:22:40 -0700 |
commit | cef83fcda8f20c2ebfd17432b429b6f109cf978f (patch) | |
tree | a8f6e69bade8a2a7486ac0168426a77f6a013295 | |
parent | 0f0d34977a9d2c003ed9fedf923cfaf86240d667 (diff) | |
download | git-cef83fcda8f20c2ebfd17432b429b6f109cf978f.tar.gz |
unix-socket.c: add stub implementation when unix sockets are not supported
This keeps #ifdef at the callee instead of caller, it's less messier.
The caller in question is in read-cache.c which, unlike other
unix-socket callers so far, is always built regardless of unix socket
support. No extra handling (for ENOSYS) is needed because in this
build, index-helper does not exist, $GIT_DIR/index-helper.sock does
not exist, so no unix socket call is made by read-cache.c in the first
place.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | unix-socket.h | 18 |
2 files changed, 20 insertions, 0 deletions
@@ -1341,6 +1341,8 @@ ifndef NO_UNIX_SOCKETS LIB_OBJS += unix-socket.o 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 e271aeec5a..f1cba7074b 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 */ |