projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cp: revert a recent buggy change, and add a comment why it's wrong
[oweals/busybox.git]
/
libpwdgrp
/
pwd_grp.c
diff --git
a/libpwdgrp/pwd_grp.c
b/libpwdgrp/pwd_grp.c
index 223cbde36890c335755c40c1e62e2f789f9c42ef..947f48d432e6e7d6f38e400618055b6a99fea8db 100644
(file)
--- a/
libpwdgrp/pwd_grp.c
+++ b/
libpwdgrp/pwd_grp.c
@@
-19,7
+19,7
@@
*/
#include "libbb.h"
*/
#include "libbb.h"
-#include <features.h>
+
//
#include <features.h>
#include <assert.h>
#ifndef _PATH_SHADOW
#include <assert.h>
#ifndef _PATH_SHADOW
@@
-661,15
+661,11
@@
int initgroups(const char *user, gid_t gid)
int ngroups;
gid_t *group_list = getgrouplist_internal(&ngroups, user, gid);
int ngroups;
gid_t *group_list = getgrouplist_internal(&ngroups, user, gid);
- if (!group_list)
- return -1;
-
ngroups = setgroups(ngroups, group_list);
free(group_list);
return ngroups;
}
ngroups = setgroups(ngroups, group_list);
free(group_list);
return ngroups;
}
-/* TODO: uclibc needs this ported to it! */
int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups)
{
int ngroups_old = *ngroups;
int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups)
{
int ngroups_old = *ngroups;
@@
-820,7
+816,7
@@
static int bb__parsepwent(void *data, char *line)
i = 0;
do {
i = 0;
do {
- p = (
(char *) ((struct passwd *) data))
+ pw_off[i];
+ p = (
char *) data
+ pw_off[i];
if ((i & 6) ^ 2) { /* i!=2 and i!=3 */
*((char **) p) = line;
if ((i & 6) ^ 2) { /* i!=2 and i!=3 */
*((char **) p) = line;
@@
-877,7
+873,7
@@
static int bb__parsegrent(void *data, char *line)
end_of_buf = ((struct group *) data)->gr_name; /* Evil hack! */
i = 0;
do {
end_of_buf = ((struct group *) data)->gr_name; /* Evil hack! */
i = 0;
do {
- p = (
(char *) ((struct group *) data))
+ gr_off[i];
+ p = (
char *) data
+ gr_off[i];
if (i < 2) {
*((char **) p) = line;
if (i < 2) {
*((char **) p) = line;
@@
-970,15
+966,15
@@
static const unsigned char sp_off[] ALIGN1 = {
offsetof(struct spwd, sp_flag) /* 8 - not a char ptr */
};
offsetof(struct spwd, sp_flag) /* 8 - not a char ptr */
};
-static int bb__parsespent(void *data, char *
line)
+static int bb__parsespent(void *data, char *line)
{
char *endptr;
char *p;
int i;
i = 0;
{
char *endptr;
char *p;
int i;
i = 0;
-
do
{
- p = (
(char *) ((struct spwd *) data))
+ sp_off[i];
+
while (1)
{
+ p = (
char *) data
+ sp_off[i];
if (i < 2) {
*((char **) p) = line;
line = strchr(line, ':');
if (i < 2) {
*((char **) p) = line;
line = strchr(line, ':');
@@
-986,10
+982,10
@@
static int bb__parsespent(void *data, char * line)
break;
}
} else {
break;
}
} else {
- *((long *) p) =
(long)
strtoul(line, &endptr, 10);
+ *((long *) p) = strtoul(line, &endptr, 10);
if (endptr == line) {
if (endptr == line) {
- *((long *) p) = (
(i != 8) ? -1L : ((long)(~0UL))
);
+ *((long *) p) = (
i != 8) ? -1L : (long)(~0UL
);
}
line = endptr;
}
line = endptr;
@@
-1007,9
+1003,9
@@
static int bb__parsespent(void *data, char * line)
}
}
- *line++ =
0
;
+ *line++ =
'\0'
;
++i;
++i;
- }
while (1);
+ }
return EINVAL;
}
return EINVAL;
}