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
06767316
Unverified
Commit
06767316
authored
Dec 09, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxclock: cleanup lxc_newlock()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
b19fbb7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
23 deletions
+15
-23
lxclock.c
src/lxc/lxclock.c
+15
-23
No files found.
src/lxc/lxclock.c
View file @
06767316
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "config.h"
#include "config.h"
#include "log.h"
#include "log.h"
#include "lxclock.h"
#include "lxclock.h"
#include "memory_utils.h"
#include "utils.h"
#include "utils.h"
#ifdef MUTEX_DEBUGGING
#ifdef MUTEX_DEBUGGING
...
@@ -149,35 +150,26 @@ static sem_t *lxc_new_unnamed_sem(void)
...
@@ -149,35 +150,26 @@ static sem_t *lxc_new_unnamed_sem(void)
struct
lxc_lock
*
lxc_newlock
(
const
char
*
lxcpath
,
const
char
*
name
)
struct
lxc_lock
*
lxc_newlock
(
const
char
*
lxcpath
,
const
char
*
name
)
{
{
struct
lxc_lock
*
l
;
__do_free
struct
lxc_lock
*
l
=
NULL
;
l
=
m
alloc
(
sizeof
(
*
l
));
l
=
z
alloc
(
sizeof
(
*
l
));
if
(
!
l
)
if
(
!
l
)
goto
on_error
;
return
ret_set_errno
(
NULL
,
ENOMEM
);
if
(
!
name
)
{
if
(
name
)
{
l
->
type
=
LXC_LOCK_FLOCK
;
l
->
u
.
f
.
fname
=
lxclock_name
(
lxcpath
,
name
);
if
(
!
l
->
u
.
f
.
fname
)
return
ret_set_errno
(
NULL
,
ENOMEM
);
l
->
u
.
f
.
fd
=
-
EBADF
;
}
else
{
l
->
type
=
LXC_LOCK_ANON_SEM
;
l
->
type
=
LXC_LOCK_ANON_SEM
;
l
->
u
.
sem
=
lxc_new_unnamed_sem
();
l
->
u
.
sem
=
lxc_new_unnamed_sem
();
if
(
!
l
->
u
.
sem
)
{
if
(
!
l
->
u
.
sem
)
free
(
l
);
return
ret_set_errno
(
NULL
,
ENOMEM
);
l
=
NULL
;
}
goto
on_error
;
}
}
l
->
type
=
LXC_LOCK_FLOCK
;
return
move_ptr
(
l
);
l
->
u
.
f
.
fname
=
lxclock_name
(
lxcpath
,
name
);
if
(
!
l
->
u
.
f
.
fname
)
{
free
(
l
);
l
=
NULL
;
goto
on_error
;
}
l
->
u
.
f
.
fd
=
-
1
;
on_error:
return
l
;
}
}
int
lxclock
(
struct
lxc_lock
*
l
,
int
timeout
)
int
lxclock
(
struct
lxc_lock
*
l
,
int
timeout
)
...
...
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