Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
f567e9b3
Commit
f567e9b3
authored
Feb 20, 2004
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Guard against and out-of-memory condition.
- Don't use the NGROUPS_MAX define.
parent
40ae4f93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
uidlist.c
uidlist.c
+7
-6
No files found.
uidlist.c
View file @
f567e9b3
...
...
@@ -29,10 +29,6 @@
# if !defined(GETGROUPS_T)
# define GETGROUPS_T gid_t
# endif
# ifndef NGROUPS_MAX
/* It ought to be defined, but just in case. */
# define NGROUPS_MAX 32
# endif
#endif
extern
int
verbose
;
...
...
@@ -110,9 +106,11 @@ static int is_in_group(gid_t gid)
return
last_out
;
if
(
ngroups
<
-
1
)
{
gid_t
mygid
=
MY_GID
();
if
((
ngroups
=
getgroups
(
0
,
0
))
<
0
)
if
((
ngroups
=
getgroups
(
0
,
NULL
))
<
0
)
ngroups
=
0
;
gidset
=
new_array
(
GETGROUPS_T
,
ngroups
+
1
);
if
(
!
gidset
)
out_of_memory
(
"is_in_group"
);
if
(
ngroups
>
0
)
ngroups
=
getgroups
(
ngroups
,
gidset
);
/* The default gid might not be in the list on some systems. */
...
...
@@ -123,8 +121,10 @@ static int is_in_group(gid_t gid)
if
(
n
==
ngroups
)
gidset
[
ngroups
++
]
=
mygid
;
if
(
verbose
>
3
)
{
char
gidbuf
[
NGROUPS_MAX
*
16
+
32
];
int
pos
;
char
*
gidbuf
=
new_array
(
char
,
ngroups
*
21
+
32
);
if
(
!
gidbuf
)
out_of_memory
(
"is_in_group"
);
sprintf
(
gidbuf
,
"process has %d gid%s: "
,
ngroups
,
ngroups
==
1
?
""
:
"s"
);
pos
=
strlen
(
gidbuf
);
...
...
@@ -133,6 +133,7 @@ static int is_in_group(gid_t gid)
pos
+=
strlen
(
gidbuf
+
pos
);
}
rprintf
(
FINFO
,
"%s
\n
"
,
gidbuf
);
free
(
gidbuf
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment