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
dd94de5a
Unverified
Commit
dd94de5a
authored
Jul 26, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include: remove VLAs
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
f994bc87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
ifaddrs.c
src/include/ifaddrs.c
+10
-1
lxcmntent.c
src/include/lxcmntent.c
+5
-1
No files found.
src/include/ifaddrs.c
View file @
dd94de5a
...
...
@@ -575,7 +575,15 @@ int getifaddrs(struct ifaddrs **ifap)
}
unsigned
l_numLinks
=
countLinks
(
l_socket
,
l_linkResults
)
+
countLinks
(
l_socket
,
l_addrResults
);
struct
ifaddrs
*
l_links
[
l_numLinks
];
struct
ifaddrs
**
l_links
;
l_links
=
malloc
(
l_numLinks
*
sizeof
(
struct
ifaddrs
*
));
if
(
!
l_links
)
{
close
(
l_socket
);
freeResultList
(
l_linkResults
);
return
-
1
;
}
memset
(
l_links
,
0
,
l_numLinks
*
sizeof
(
struct
ifaddrs
*
));
interpret
(
l_socket
,
l_linkResults
,
l_links
,
ifap
);
...
...
@@ -583,6 +591,7 @@ int getifaddrs(struct ifaddrs **ifap)
freeResultList
(
l_linkResults
);
freeResultList
(
l_addrResults
);
free
(
l_links
);
close
(
l_socket
);
return
0
;
}
...
...
src/include/lxcmntent.c
View file @
dd94de5a
...
...
@@ -18,6 +18,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <alloca.h>
#include <stdio.h>
#include <string.h>
#include <mntent.h>
...
...
@@ -153,7 +154,10 @@ FILE *setmntent (const char *file, const char *mode)
/* Extend the mode parameter with "c" to disable cancellation in the
I/O functions and "e" to set FD_CLOEXEC. */
size_t
modelen
=
strlen
(
mode
);
char
newmode
[
modelen
+
3
];
char
*
newmode
;
newmode
=
alloca
(
modelen
+
3
);
memcpy
(
newmode
,
mode
,
modelen
);
memcpy
(
newmode
+
modelen
,
"ce"
,
3
);
FILE
*
result
=
fopen
(
file
,
newmode
);
...
...
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