Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Upstream-Status: Inappropriate [this is 2.18(GPLv2) specific] |
| 2 | |
| 3 | # glibc also implements the function group_member. To avoid name conflict, |
| 4 | # here let us append a "_" to which's version. |
| 5 | # |
| 6 | # Signed-off-by Dexuan Cui <dexuan.cui@intel.com>, 2010-08-20 |
| 7 | # (this patch is licensed under GPLv2) |
| 8 | |
| 9 | --- which-2.18/bash.c |
| 10 | +++ which-2.18/bash.c |
| 11 | @@ -45,7 +45,12 @@ |
| 12 | * - changed all occurences of 'gid_t' into 'GID_T'. |
| 13 | * - exported functions needed in which.c |
| 14 | */ |
| 15 | -static int group_member (GID_T gid); |
| 16 | + |
| 17 | +/* |
| 18 | + * glibc also implements the function group_member. To avoid name conflict, |
| 19 | + * here let us append a "_" to which's version. |
| 20 | + */ |
| 21 | +static int _group_member (GID_T gid); |
| 22 | static char* extract_colon_unit (char const* string, int *p_index); |
| 23 | |
| 24 | /*=========================================================================== |
| 25 | @@ -200,8 +205,8 @@ |
| 26 | |
| 27 | /* From bash-2.05b / general.c / line 805 */ |
| 28 | /* Return non-zero if GID is one that we have in our groups list. */ |
| 29 | -int |
| 30 | -group_member (GID_T gid) |
| 31 | +static int |
| 32 | +_group_member (GID_T gid) |
| 33 | { |
| 34 | #if defined (HAVE_GETGROUPS) |
| 35 | register int i; |
| 36 | @@ -290,7 +295,7 @@ |
| 37 | return (X_BIT (u_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS; |
| 38 | |
| 39 | /* Otherwise, if we are in the owning group, the group permissions apply. */ |
| 40 | - if (group_member (finfo.st_gid)) |
| 41 | + if (_group_member (finfo.st_gid)) |
| 42 | return (X_BIT (g_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS; |
| 43 | |
| 44 | /* Otherwise, if we are in the other group, the other permissions apply. */ |
| 45 | @@ -331,7 +336,7 @@ |
| 46 | /* Given a string containing units of information separated by colons, |
| 47 | return the next one pointed to by (P_INDEX), or NULL if there are no more. |
| 48 | Advance (P_INDEX) to the character after the colon. */ |
| 49 | -char* |
| 50 | +static char* |
| 51 | extract_colon_unit (char const* string, int* p_index) |
| 52 | { |
| 53 | int i, start, len; |