Mercurial > emacs
diff src/w32.c @ 89909:68c22ea6027c
Sync to HEAD
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 16 Apr 2004 12:51:06 +0000 |
parents | 375f2633d815 |
children | 4c90ffeb71c5 |
line wrap: on
line diff
--- a/src/w32.c Thu Apr 15 01:08:34 2004 +0000 +++ b/src/w32.c Fri Apr 16 12:51:06 2004 +0000 @@ -66,6 +66,7 @@ #include "lisp.h" #include <pwd.h> +#include <grp.h> #ifdef __GNUC__ #define _ANONYMOUS_UNION @@ -385,6 +386,13 @@ the_passwd_shell, }; +static struct group the_group = +{ + /* There are no groups on NT, so we just return "root" as the + group name. */ + "root", +}; + int getuid () { @@ -420,6 +428,12 @@ return NULL; } +struct group * +getgrgid (gid_t gid) +{ + return &the_group; +} + struct passwd * getpwnam (char *name) { @@ -3450,11 +3464,22 @@ if (rc == 0) { - flags = FILE_PIPE | FILE_READ | FILE_BINARY; - fd_info[phandles[0]].flags = flags; - - flags = FILE_PIPE | FILE_WRITE | FILE_BINARY; - fd_info[phandles[1]].flags = flags; + /* Protect against overflow, since Windows can open more handles than + our fd_info array has room for. */ + if (phandles[0] >= MAXDESC || phandles[1] >= MAXDESC) + { + _close (phandles[0]); + _close (phandles[1]); + rc = -1; + } + else + { + flags = FILE_PIPE | FILE_READ | FILE_BINARY; + fd_info[phandles[0]].flags = flags; + + flags = FILE_PIPE | FILE_WRITE | FILE_BINARY; + fd_info[phandles[1]].flags = flags; + } } return rc; @@ -3955,3 +3980,6 @@ } /* end of nt.c */ + +/* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1 + (do not change this comment) */