{"thread":{"id":"25521","subject":"[PATCH] add support for the SUA layer (interix; windows)","startedAt":"2010-10-22T09:56:41Z","lastAt":"2010-10-22T17:01:15Z","messageCount":2,"participants":["mduft@s01en22.salomon.at","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"154130","messageId":"1287741401-17941-1-git-send-email-mduft@gentoo.org","threadId":"25521","inReplyTo":null,"subject":"[PATCH] add support for the SUA layer (interix; windows)","fromName":"","fromEmail":"mduft@s01en22.salomon.at","sentAt":"2010-10-22T09:56:41Z","receivedAt":"2010-10-22T09:56:41Z","isPatch":true,"sender":{"key":"mduft@s01en22.salomon.at","avatar":null},"body":"* add required build options to Makefile.\n* introduce new NO_INTTYPES_H for systems lacking inttypes; code\n  includes stdint.h instead, if this is set.\n* introduce new NO_SYS_POLL_H for systems lacking sys/poll.h; code\n  includes poll.h instead, if this is set.\n* introduce NO_INITGROUPS. initgroups() call is simply omitted.\n\nSigned-off-by: Markus Duft <mduft@gentoo.org>\n---\n Makefile          |   28 ++++++++++++++++++++++++++++\n daemon.c          |    6 +++++-\n git-compat-util.h |    8 ++++++++\n 3 files changed, 41 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 1f1ce04..c9d8c9e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1096,6 +1096,25 @@ else\n endif\n \tX = .exe\n endif\n+ifeq ($(uname_S),Interix)\n+\tNO_SYS_POLL_H = YesPlease\n+\tNO_INTTYPES_H = YesPlease\n+\tNO_INITGROUPS = YesPlease\n+\tNO_IPV6 = YesPlease\n+\tNO_MEMMEM = YesPlease\n+\tNO_MKDTEMP = YesPlease\n+\tNO_STRTOUMAX = YesPlease\n+\tNO_NSEC = YesPlease\n+\tNO_MKSTEMPS = YesPlease\n+\tifeq ($(uname_R),3.5)\n+\t\tNO_INET_NTOP = YesPlease\n+\t\tNO_INET_PTON = YesPlease\n+\tendif\n+\tifeq ($(uname_R),5.2)\n+\t\tNO_INET_NTOP = YesPlease\n+\t\tNO_INET_PTON = YesPlease\n+\tendif\n+endif\n ifneq (,$(findstring MINGW,$(uname_S)))\n \tpathsep = ;\n \tNO_PREAD = YesPlease\n@@ -1360,6 +1379,15 @@ endif\n ifdef NO_SYS_SELECT_H\n \tBASIC_CFLAGS += -DNO_SYS_SELECT_H\n endif\n+ifdef NO_SYS_POLL_H\n+\tBASIC_CFLAGS += -DNO_SYS_POLL_H\n+endif\n+ifdef NO_INTTYPES_H\n+\tBASIC_CFLAGS += -DNO_INTTYPES_H\n+endif\n+ifdef NO_INITGROUPS\n+\tBASIC_CFLAGS += -DNO_INITGROUPS\n+endif\n ifdef NO_MMAP\n \tCOMPAT_CFLAGS += -DNO_MMAP\n \tCOMPAT_OBJS += compat/mmap.o\ndiff --git a/daemon.c b/daemon.c\nindex 9326d3a..d68a31f 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -956,7 +956,11 @@ static int serve(char *listen_addr, int listen_port, struct passwd *pass, gid_t\n \t\t    listen_addr, listen_port);\n \n \tif (pass && gid &&\n-\t    (initgroups(pass->pw_name, gid) || setgid (gid) ||\n+\t    (\n+#ifndef NO_INITGROUPS\n+\t\t    initgroups(pass->pw_name, gid) || \n+#endif\n+\t     setgid (gid) ||\n \t     setuid(pass->pw_uid)))\n \t\tdie(\"cannot drop privileges\");\n \ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 2af8d3e..625b2e4 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -106,7 +106,11 @@\n #include <utime.h>\n #ifndef __MINGW32__\n #include <sys/wait.h>\n+#ifndef NO_SYS_POLL_H\n #include <sys/poll.h>\n+#else\n+#include <poll.h>\n+#endif\n #include <sys/socket.h>\n #include <sys/ioctl.h>\n #include <termios.h>\n@@ -118,7 +122,11 @@\n #include <arpa/inet.h>\n #include <netdb.h>\n #include <pwd.h>\n+#ifndef NO_INTTYPES_H\n #include <inttypes.h>\n+#else\n+#include <stdint.h>\n+#endif\n #if defined(__CYGWIN__)\n #undef _XOPEN_SOURCE\n #include <grp.h>\n-- \n1.7.2.2\n"},{"id":"154168","messageId":"m362wukvs5.fsf@localhost.localdomain","threadId":"25521","inReplyTo":"1287741401-17941-1-git-send-email-mduft@gentoo.org","subject":"Re: [PATCH] add support for the SUA layer (interix; windows)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-10-22T17:01:15Z","receivedAt":"2010-10-22T17:01:15Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"mduft@s01en22.salomon.at writes:\n\n> * add required build options to Makefile.\n> * introduce new NO_INTTYPES_H for systems lacking inttypes; code\n>   includes stdint.h instead, if this is set.\n> * introduce new NO_SYS_POLL_H for systems lacking sys/poll.h; code\n>   includes poll.h instead, if this is set.\n> * introduce NO_INITGROUPS. initgroups() call is simply omitted.\n> \n> Signed-off-by: Markus Duft <mduft@gentoo.org>\n> ---\n>  Makefile          |   28 ++++++++++++++++++++++++++++\n>  daemon.c          |    6 +++++-\n>  git-compat-util.h |    8 ++++++++\n>  3 files changed, 41 insertions(+), 1 deletions(-)\n\nCould you also add appropriate detection to configure.ac?\nThanks in advance.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}