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
54b43e8f
Unverified
Commit
54b43e8f
authored
Feb 05, 2019
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: remove stack allocations
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
f5849fd7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
monitor.c
src/lxc/monitor.c
+3
-2
No files found.
src/lxc/monitor.c
View file @
54b43e8f
...
@@ -49,6 +49,7 @@
...
@@ -49,6 +49,7 @@
#include "log.h"
#include "log.h"
#include "lxclock.h"
#include "lxclock.h"
#include "macro.h"
#include "macro.h"
#include "memory_utils.h"
#include "monitor.h"
#include "monitor.h"
#include "state.h"
#include "state.h"
#include "utils.h"
#include "utils.h"
...
@@ -170,9 +171,9 @@ int lxc_monitor_close(int fd)
...
@@ -170,9 +171,9 @@ int lxc_monitor_close(int fd)
*/
*/
int
lxc_monitor_sock_name
(
const
char
*
lxcpath
,
struct
sockaddr_un
*
addr
)
int
lxc_monitor_sock_name
(
const
char
*
lxcpath
,
struct
sockaddr_un
*
addr
)
{
{
__do_free
char
*
path
;
size_t
len
;
size_t
len
;
int
ret
;
int
ret
;
char
*
path
;
uint64_t
hash
;
uint64_t
hash
;
/* addr.sun_path is only 108 bytes, so we hash the full name and
/* addr.sun_path is only 108 bytes, so we hash the full name and
...
@@ -183,7 +184,7 @@ int lxc_monitor_sock_name(const char *lxcpath, struct sockaddr_un *addr)
...
@@ -183,7 +184,7 @@ int lxc_monitor_sock_name(const char *lxcpath, struct sockaddr_un *addr)
/* strlen("lxc/") + strlen("/monitor-sock") + 1 = 18 */
/* strlen("lxc/") + strlen("/monitor-sock") + 1 = 18 */
len
=
strlen
(
lxcpath
)
+
18
;
len
=
strlen
(
lxcpath
)
+
18
;
path
=
alloca
(
len
);
path
=
must_realloc
(
NULL
,
len
);
ret
=
snprintf
(
path
,
len
,
"lxc/%s/monitor-sock"
,
lxcpath
);
ret
=
snprintf
(
path
,
len
,
"lxc/%s/monitor-sock"
,
lxcpath
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
len
)
{
if
(
ret
<
0
||
(
size_t
)
ret
>=
len
)
{
ERROR
(
"Failed to create name for monitor socket"
);
ERROR
(
"Failed to create name for monitor socket"
);
...
...
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