Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
1b7eaf07
Commit
1b7eaf07
authored
Jun 01, 2015
by
Henrik Kjölhede
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added check against negative malloc and cleaned up comments
Signed-off-by:
Henrik Kjölhede
<
hkjolhede@gmail.com
>
parent
3043883c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
lxc_user_nic.c
src/lxc/lxc_user_nic.c
+11
-3
No files found.
src/lxc/lxc_user_nic.c
View file @
1b7eaf07
...
@@ -106,6 +106,12 @@ static char **get_groupnames(void)
...
@@ -106,6 +106,12 @@ static char **get_groupnames(void)
struct
group
*
gr
;
struct
group
*
gr
;
ngroups
=
getgroups
(
0
,
NULL
);
ngroups
=
getgroups
(
0
,
NULL
);
if
(
ngroups
==
-
1
)
{
fprintf
(
stderr
,
"Failed to get number of groups user belongs to
\n
"
);
return
NULL
;
}
group_ids
=
(
gid_t
*
)
malloc
(
sizeof
(
gid_t
)
*
ngroups
);
group_ids
=
(
gid_t
*
)
malloc
(
sizeof
(
gid_t
)
*
ngroups
);
ret
=
getgroups
(
ngroups
,
group_ids
);
ret
=
getgroups
(
ngroups
,
group_ids
);
...
@@ -242,11 +248,13 @@ static int get_alloted(char *me, char *intype, char *link, struct alloted_s **al
...
@@ -242,11 +248,13 @@ static int get_alloted(char *me, char *intype, char *link, struct alloted_s **al
if
(
strcmp
(
link
,
br
)
!=
0
)
if
(
strcmp
(
link
,
br
)
!=
0
)
continue
;
continue
;
/* found the user with the appropriate settings, therefore finish the search.
* what to do if there are more than one applicable lines? not specified in the docs.
* since getline is implemented with realloc, we don't need to free line until exiting func.
*/
append_alloted
(
alloted
,
me
,
n
);
append_alloted
(
alloted
,
me
,
n
);
count
+=
n
;
count
+=
n
;
break
;
// found the user with the appropriate settings, therefore finish the search.
break
;
// what to do if there are more than one applicable lines? not specified in the docs.
// since getline is implemented with realloc, we don't need to free line until exiting func.
}
}
// now parse any possible groups specified
// now parse any possible groups specified
...
...
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