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
121e90aa
Commit
121e90aa
authored
Aug 12, 2016
by
Serge Hallyn
Committed by
GitHub
Aug 12, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1126 from brauner/2016-08-13/fix_runtime_path_for_lxc_ls
tools: use correct runtime path for lxc-ls
parents
6fe1146d
2263d595
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
lxc_ls.c
src/lxc/tools/lxc_ls.c
+20
-5
No files found.
src/lxc/tools/lxc_ls.c
View file @
121e90aa
...
@@ -986,25 +986,40 @@ out:
...
@@ -986,25 +986,40 @@ out:
static
int
ls_remove_lock
(
const
char
*
path
,
const
char
*
name
,
static
int
ls_remove_lock
(
const
char
*
path
,
const
char
*
name
,
char
**
lockpath
,
size_t
*
len_lockpath
,
bool
recalc
)
char
**
lockpath
,
size_t
*
len_lockpath
,
bool
recalc
)
{
{
int
ret
=
-
1
;
char
*
rundir
;
/* lockfile will be:
* "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
* $XDG_RUNTIME_DIR + "/lxc/lock/$lxcpath/$lxcname + '\0' if non-root
*/
rundir
=
get_rundir
();
if
(
!
rundir
)
goto
out
;
/* Avoid doing unnecessary work if we can. */
/* Avoid doing unnecessary work if we can. */
if
(
recalc
)
{
if
(
recalc
)
{
size_t
newlen
=
strlen
(
path
)
+
strlen
(
name
)
+
strlen
(
RUNTIME_PATH
)
+
/* / + lxc + / + lock + / + / = */
11
+
1
;
size_t
newlen
=
strlen
(
path
)
+
strlen
(
name
)
+
strlen
(
rundir
)
+
/* / + lxc + / + lock + / + / = */
11
+
1
;
if
(
newlen
>
*
len_lockpath
)
{
if
(
newlen
>
*
len_lockpath
)
{
char
*
tmp
=
realloc
(
*
lockpath
,
newlen
*
2
);
char
*
tmp
=
realloc
(
*
lockpath
,
newlen
*
2
);
if
(
!
tmp
)
if
(
!
tmp
)
return
-
1
;
goto
out
;
*
lockpath
=
tmp
;
*
lockpath
=
tmp
;
*
len_lockpath
=
newlen
*
2
;
*
len_lockpath
=
newlen
*
2
;
}
}
}
}
int
check
=
snprintf
(
*
lockpath
,
*
len_lockpath
,
"%s/lxc/lock/%s/%s"
,
RUNTIME_PATH
,
path
,
name
);
int
check
=
snprintf
(
*
lockpath
,
*
len_lockpath
,
"%s/lxc/lock/%s/%s"
,
rundir
,
path
,
name
);
if
(
check
<
0
||
(
size_t
)
check
>=
*
len_lockpath
)
if
(
check
<
0
||
(
size_t
)
check
>=
*
len_lockpath
)
return
-
1
;
goto
out
;
lxc_rmdir_onedev
(
*
lockpath
,
NULL
);
lxc_rmdir_onedev
(
*
lockpath
,
NULL
);
ret
=
0
;
return
0
;
out:
free
(
rundir
);
return
ret
;
}
}
static
int
ls_send_str
(
int
fd
,
const
char
*
buf
)
static
int
ls_send_str
(
int
fd
,
const
char
*
buf
)
...
...
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