diff options
author | Christopher Faylor <me@cgf.cx> | 2001-09-07 21:32:07 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-09-07 21:32:07 +0000 |
commit | 1ff9f4b9373620aa923412d7aa90b8d04d940199 (patch) | |
tree | 878c4a44487d2fe17137a6d6088a327ada14247b /winsup/cygwin/grp.cc | |
parent | b2d319cb3eaf0c1a139ee1586fa43d5250d5a058 (diff) | |
download | cygnal-1ff9f4b9373620aa923412d7aa90b8d04d940199.tar.gz cygnal-1ff9f4b9373620aa923412d7aa90b8d04d940199.tar.bz2 cygnal-1ff9f4b9373620aa923412d7aa90b8d04d940199.zip |
* cygheap.h (init_cygheap): Move heap pointers here.
* include/sys/cygwin.h (perprocess): Remove heap pointers.
* dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff.
(_dll_crt0): Don't initialize heap pointers.
(cygwin_dll_init): Ditto.
(release_upto): Use heap pointers from cygheap.
* heap.h: Ditto.
* fork.cc (fork_parent): Ditto. Don't set heap pointers in ch.
(fork_child): Remove obsolete sigproc_fixup_after_fork.
* shared.cc (memory_init): Reorganize so that cygheap initialization is called
prior to regular heap since regular heap uses cygheap now.
* sigproc.cc (proc_subproc): Eliminate zombies allocation.
(sigproc_init): Move zombies alloation here. Don't free up array on fork, just
reuse it.
(sigproc_fixup_after_fork): Eliminate.
* sigproc.h: Ditto.
* include/cygwin/version.h: Reflect change to perprocess structure.
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r-- | winsup/cygwin/grp.cc | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index e73c9a058..b70db13f8 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -83,7 +83,7 @@ public: last_modified = data.ftLastWriteTime; } FindClose (h); - } + } return state; } void operator = (grp_state nstate) @@ -118,37 +118,37 @@ parse_grp (struct group &grp, const char *line) { *dp++ = '\0'; if (!strlen (grp.gr_passwd)) - grp.gr_passwd = NULL; + grp.gr_passwd = NULL; grp.gr_gid = strtol (dp, NULL, 10); dp = strchr (dp, ':'); if (dp) - { - if (*++dp) - { - int i = 0; - char *cp; - - for (cp = dp; (cp = strchr (cp, ',')) != NULL; ++cp) - ++i; - char **namearray = (char **) calloc (i + 2, sizeof (char *)); - if (namearray) - { - i = 0; - for (cp = dp; (cp = strchr (dp, ',')) != NULL; dp = cp + 1) - { - *cp = '\0'; - namearray[i++] = dp; - } - namearray[i++] = dp; - namearray[i] = NULL; - } + { + if (*++dp) + { + int i = 0; + char *cp; + + for (cp = dp; (cp = strchr (cp, ',')) != NULL; ++cp) + ++i; + char **namearray = (char **) calloc (i + 2, sizeof (char *)); + if (namearray) + { + i = 0; + for (cp = dp; (cp = strchr (dp, ',')) != NULL; dp = cp + 1) + { + *cp = '\0'; + namearray[i++] = dp; + } + namearray[i++] = dp; + namearray[i] = NULL; + } grp.gr_mem = namearray; - } - else - grp.gr_mem = (char **) calloc (1, sizeof (char *)); - return 1; - } + } + else + grp.gr_mem = (char **) calloc (1, sizeof (char *)); + return 1; + } } return 0; } @@ -195,7 +195,7 @@ read_etc_group () { group_state = initializing; if (max_lines) /* When rereading, free allocated memory first. */ - { + { for (int i = 0; i < curr_lines; ++i) { free (group_buf[i].gr_name); @@ -256,9 +256,9 @@ getgrgid (gid_t gid) for (int i = 0; i < curr_lines; i++) { if (group_buf[i].gr_gid == DEFAULT_GID) - default_grp = group_buf + i; + default_grp = group_buf + i; if (group_buf[i].gr_gid == gid) - return group_buf + i; + return group_buf + i; } return default_grp; @@ -333,8 +333,8 @@ getgroups (int gidsetsize, gid_t *grouplist, gid_t gid, const char *username) OpenProcessToken (hMainProc, TOKEN_QUERY, &hToken)) { if (GetTokenInformation (hToken, TokenGroups, NULL, 0, &size) - || GetLastError () == ERROR_INSUFFICIENT_BUFFER) - { + || GetLastError () == ERROR_INSUFFICIENT_BUFFER) + { char buf[size]; TOKEN_GROUPS *groups = (TOKEN_GROUPS *) buf; @@ -358,12 +358,12 @@ getgroups (int gidsetsize, gid_t *grouplist, gid_t gid, const char *username) break; } } - } + } else - debug_printf ("%d = GetTokenInformation(NULL) %E", size); + debug_printf ("%d = GetTokenInformation(NULL) %E", size); CloseHandle (hToken); if (cnt) - return cnt; + return cnt; } for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx) |