comparison 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
comparison
equal deleted inserted replaced
89908:ee1402f7b568 89909:68c22ea6027c
64 #undef strerror 64 #undef strerror
65 65
66 #include "lisp.h" 66 #include "lisp.h"
67 67
68 #include <pwd.h> 68 #include <pwd.h>
69 #include <grp.h>
69 70
70 #ifdef __GNUC__ 71 #ifdef __GNUC__
71 #define _ANONYMOUS_UNION 72 #define _ANONYMOUS_UNION
72 #define _ANONYMOUS_STRUCT 73 #define _ANONYMOUS_STRUCT
73 #endif 74 #endif
383 the_passwd_gecos, 384 the_passwd_gecos,
384 the_passwd_dir, 385 the_passwd_dir,
385 the_passwd_shell, 386 the_passwd_shell,
386 }; 387 };
387 388
389 static struct group the_group =
390 {
391 /* There are no groups on NT, so we just return "root" as the
392 group name. */
393 "root",
394 };
395
388 int 396 int
389 getuid () 397 getuid ()
390 { 398 {
391 return the_passwd.pw_uid; 399 return the_passwd.pw_uid;
392 } 400 }
416 getpwuid (int uid) 424 getpwuid (int uid)
417 { 425 {
418 if (uid == the_passwd.pw_uid) 426 if (uid == the_passwd.pw_uid)
419 return &the_passwd; 427 return &the_passwd;
420 return NULL; 428 return NULL;
429 }
430
431 struct group *
432 getgrgid (gid_t gid)
433 {
434 return &the_group;
421 } 435 }
422 436
423 struct passwd * 437 struct passwd *
424 getpwnam (char *name) 438 getpwnam (char *name)
425 { 439 {
3448 if required. */ 3462 if required. */
3449 rc = _pipe (phandles, 0, _O_NOINHERIT | _O_BINARY); 3463 rc = _pipe (phandles, 0, _O_NOINHERIT | _O_BINARY);
3450 3464
3451 if (rc == 0) 3465 if (rc == 0)
3452 { 3466 {
3453 flags = FILE_PIPE | FILE_READ | FILE_BINARY; 3467 /* Protect against overflow, since Windows can open more handles than
3454 fd_info[phandles[0]].flags = flags; 3468 our fd_info array has room for. */
3455 3469 if (phandles[0] >= MAXDESC || phandles[1] >= MAXDESC)
3456 flags = FILE_PIPE | FILE_WRITE | FILE_BINARY; 3470 {
3457 fd_info[phandles[1]].flags = flags; 3471 _close (phandles[0]);
3472 _close (phandles[1]);
3473 rc = -1;
3474 }
3475 else
3476 {
3477 flags = FILE_PIPE | FILE_READ | FILE_BINARY;
3478 fd_info[phandles[0]].flags = flags;
3479
3480 flags = FILE_PIPE | FILE_WRITE | FILE_BINARY;
3481 fd_info[phandles[1]].flags = flags;
3482 }
3458 } 3483 }
3459 3484
3460 return rc; 3485 return rc;
3461 } 3486 }
3462 3487
3953 g_b_init_lookup_account_sid = 0; 3978 g_b_init_lookup_account_sid = 0;
3954 g_b_init_get_sid_identifier_authority = 0; 3979 g_b_init_get_sid_identifier_authority = 0;
3955 } 3980 }
3956 3981
3957 /* end of nt.c */ 3982 /* end of nt.c */
3983
3984 /* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1
3985 (do not change this comment) */