]> andersk Git - openssh.git/blobdiff - openbsd-compat/bsd-cygwin_util.c
- (djm) [openbsd-compat/rresvport.c] Add unistd.h for missing close()
[openssh.git] / openbsd-compat / bsd-cygwin_util.c
index eb983def2d5ec7d14ea568c7480cb774c5094786..dbf8176b6225f12beb576f1c6feeebd72137447c 100644 (file)
 
 #include "includes.h"
 
-RCSID("$Id$");
-
 #ifdef HAVE_CYGWIN
 
-#include <fcntl.h>
-#include <stdlib.h>
+#if defined(open) && open == binary_open
+# undef open
+#endif
+#if defined(pipe) && open == binary_pipe
+# undef pipe
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/utsname.h>
 #include <sys/vfs.h>
+
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <windows.h>
+
 #include "xmalloc.h"
 #define is_winnt       (GetVersion() < 0x80000000)
 
@@ -45,13 +55,6 @@ RCSID("$Id$");
 #define ntsec_off(c)   ((c) && strstr((c),"nontsec"))
 #define ntea_on(c)     ((c) && strstr((c),"ntea") && !strstr((c),"nontea"))
 
-#if defined(open) && open == binary_open
-# undef open
-#endif
-#if defined(pipe) && open == binary_pipe
-# undef pipe
-#endif
-
 int 
 binary_open(const char *filename, int flags, ...)
 {
@@ -247,6 +250,7 @@ static struct wenv {
        { NL("COMMONPROGRAMFILES=") },
        { NL("COMPUTERNAME=") },
        { NL("COMSPEC=") },
+       { NL("CYGWIN=") },
        { NL("NUMBER_OF_PROCESSORS=") },
        { NL("OS=") },
        { NL("PATH=") },
@@ -260,16 +264,16 @@ static struct wenv {
        { NL("SYSTEMROOT=") },
        { NL("TMP=") },
        { NL("TEMP=") },
-       { NL("WINDIR=") },
+       { NL("WINDIR=") }
 };
 
 char **
 fetch_windows_environment(void)
 {
        char **e, **p;
-       int i, idx = 0;
+       unsigned int i, idx = 0;
 
-       p = xmalloc(WENV_SIZ * sizeof(char *));
+       p = xcalloc(WENV_SIZ + 1, sizeof(char *));
        for (e = environ; *e != NULL; ++e) {
                for (i = 0; i < WENV_SIZ; ++i) {
                        if (!strncmp(*e, wenv_arr[i].name, wenv_arr[i].namelen))
This page took 0.038513 seconds and 4 git commands to generate.