mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 18:14:15 +00:00
include: remove VLAs
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
f994bc87af
commit
dd94de5a87
@ -575,7 +575,15 @@ int getifaddrs(struct ifaddrs **ifap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned l_numLinks = countLinks(l_socket, l_linkResults) + countLinks(l_socket, l_addrResults);
|
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 *));
|
memset(l_links, 0, l_numLinks * sizeof(struct ifaddrs *));
|
||||||
|
|
||||||
interpret(l_socket, l_linkResults, l_links, ifap);
|
interpret(l_socket, l_linkResults, l_links, ifap);
|
||||||
@ -583,6 +591,7 @@ int getifaddrs(struct ifaddrs **ifap)
|
|||||||
|
|
||||||
freeResultList(l_linkResults);
|
freeResultList(l_linkResults);
|
||||||
freeResultList(l_addrResults);
|
freeResultList(l_addrResults);
|
||||||
|
free(l_links);
|
||||||
close(l_socket);
|
close(l_socket);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <alloca.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <mntent.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
|
/* Extend the mode parameter with "c" to disable cancellation in the
|
||||||
I/O functions and "e" to set FD_CLOEXEC. */
|
I/O functions and "e" to set FD_CLOEXEC. */
|
||||||
size_t modelen = strlen (mode);
|
size_t modelen = strlen (mode);
|
||||||
char newmode[modelen + 3];
|
char *newmode;
|
||||||
|
|
||||||
|
newmode = alloca(modelen + 3);
|
||||||
|
|
||||||
memcpy (newmode, mode, modelen);
|
memcpy (newmode, mode, modelen);
|
||||||
memcpy (newmode + modelen, "ce", 3);
|
memcpy (newmode + modelen, "ce", 3);
|
||||||
FILE *result = fopen (file, newmode);
|
FILE *result = fopen (file, newmode);
|
||||||
|
Loading…
Reference in New Issue
Block a user