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
58743a87
Commit
58743a87
authored
Jan 22, 2004
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved to add the default gid if it is missing from the list.
parent
54bf456e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
getgroups.c
getgroups.c
+13
-5
No files found.
getgroups.c
View file @
58743a87
...
...
@@ -26,24 +26,32 @@
#include "rsync.h"
#ifndef NGROUPS
#ifndef NGROUPS
_MAX
/* It ought to be defined, but just in case. */
# define NGROUPS 32
# define NGROUPS
_MAX
32
#endif
int
main
(
UNUSED
(
int
argc
),
UNUSED
(
char
*
argv
[]))
{
int
n
,
i
;
gid_t
list
[
NGROUPS
];
gid_t
list
[
NGROUPS_MAX
];
gid_t
gid
=
getgid
();
int
gid_in_list
=
0
;
if
((
n
=
getgroups
(
NGROUPS
,
list
))
==
-
1
)
{
if
((
n
=
getgroups
(
NGROUPS
_MAX
,
list
))
<
0
)
{
perror
(
"getgroups"
);
return
1
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
for
(
i
=
0
;
i
<
n
;
i
++
)
{
printf
(
"%lu "
,
(
unsigned
long
)
list
[
i
]);
if
(
list
[
i
]
==
gid
)
gid_in_list
=
1
;
}
/* The default gid might not be in the list on some systems. */
if
(
!
gid_in_list
)
printf
(
"%lu"
,
(
unsigned
long
)
gid
);
printf
(
"
\n
"
);
return
0
;
...
...
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