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
be69ad43
Commit
be69ad43
authored
Feb 02, 2017
by
Tycho Andersen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util: always malloc for setproctitle
Closes #1407 Signed-off-by:
Tycho Andersen
<
tycho.andersen@canonical.com
>
parent
4ce84082
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
14 deletions
+4
-14
utils.c
src/lxc/utils.c
+4
-14
No files found.
src/lxc/utils.c
View file @
be69ad43
...
@@ -1463,34 +1463,24 @@ int setproctitle(char *title)
...
@@ -1463,34 +1463,24 @@ int setproctitle(char *title)
if
(
!
tmp
)
if
(
!
tmp
)
return
-
1
;
return
-
1
;
i
=
sscanf
(
tmp
,
"%lu %lu %lu %
lu %l
u %lu %lu"
,
i
=
sscanf
(
tmp
,
"%lu %lu %lu %
*u %*
u %lu %lu"
,
&
start_data
,
&
start_data
,
&
end_data
,
&
end_data
,
&
start_brk
,
&
start_brk
,
&
arg_start
,
&
arg_end
,
&
env_start
,
&
env_start
,
&
env_end
);
&
env_end
);
if
(
i
!=
7
)
if
(
i
!=
5
)
return
-
1
;
return
-
1
;
/* Include the null byte here, because in the calculations below we
/* Include the null byte here, because in the calculations below we
* want to have room for it. */
* want to have room for it. */
len
=
strlen
(
title
)
+
1
;
len
=
strlen
(
title
)
+
1
;
/* If we don't have enough room by just overwriting the old proctitle,
proctitle
=
realloc
(
proctitle
,
len
);
* let's allocate a new one.
if
(
!
proctitle
)
*/
if
(
len
>
arg_end
-
arg_start
)
{
void
*
m
;
m
=
realloc
(
proctitle
,
len
);
if
(
!
m
)
return
-
1
;
return
-
1
;
proctitle
=
m
;
arg_start
=
(
unsigned
long
)
proctitle
;
arg_start
=
(
unsigned
long
)
proctitle
;
}
arg_end
=
arg_start
+
len
;
arg_end
=
arg_start
+
len
;
brk_val
=
syscall
(
__NR_brk
,
0
);
brk_val
=
syscall
(
__NR_brk
,
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