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
f4d45f9a
Unverified
Commit
f4d45f9a
authored
Dec 09, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: cleanup get_rundir()
Fixes: Coverity 1461740 Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
1b89b88a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
utils.c
src/lxc/utils.c
+11
-6
No files found.
src/lxc/utils.c
View file @
f4d45f9a
...
...
@@ -240,7 +240,9 @@ int mkdir_p(const char *dir, mode_t mode)
char
*
get_rundir
()
{
char
*
rundir
;
__do_free
char
*
rundir
=
NULL
;
char
*
static_rundir
;
int
ret
;
size_t
len
;
const
char
*
homedir
;
struct
stat
sb
;
...
...
@@ -251,9 +253,9 @@ char *get_rundir()
if
(
geteuid
()
==
sb
.
st_uid
||
getegid
()
==
sb
.
st_gid
)
return
strdup
(
RUNTIME_PATH
);
rundir
=
getenv
(
"XDG_RUNTIME_DIR"
);
if
(
rundir
)
return
strdup
(
rundir
);
static_
rundir
=
getenv
(
"XDG_RUNTIME_DIR"
);
if
(
static_
rundir
)
return
strdup
(
static_
rundir
);
INFO
(
"XDG_RUNTIME_DIR isn't set in the environment"
);
homedir
=
getenv
(
"HOME"
);
...
...
@@ -265,8 +267,11 @@ char *get_rundir()
if
(
!
rundir
)
return
NULL
;
snprintf
(
rundir
,
len
,
"%s/.cache/lxc/run/"
,
homedir
);
return
rundir
;
ret
=
snprintf
(
rundir
,
len
,
"%s/.cache/lxc/run/"
,
homedir
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
len
)
return
ret_set_errno
(
NULL
,
EIO
);
return
move_ptr
(
rundir
);
}
int
wait_for_pid
(
pid_t
pid
)
...
...
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