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
55cf04e3
Unverified
Commit
55cf04e3
authored
Mar 20, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ringbuf: fix cleanup operations
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
eafc1bb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
ringbuf.c
src/lxc/ringbuf.c
+1
-5
ringbuf.h
src/lxc/ringbuf.h
+2
-1
No files found.
src/lxc/ringbuf.c
View file @
55cf04e3
...
@@ -20,9 +20,9 @@
...
@@ -20,9 +20,9 @@
int
lxc_ringbuf_create
(
struct
lxc_ringbuf
*
buf
,
size_t
size
)
int
lxc_ringbuf_create
(
struct
lxc_ringbuf
*
buf
,
size_t
size
)
{
{
__do_close
int
memfd
=
-
EBADF
;
char
*
tmp
;
char
*
tmp
;
int
ret
;
int
ret
;
int
memfd
=
-
1
;
buf
->
size
=
size
;
buf
->
size
=
size
;
buf
->
r_off
=
0
;
buf
->
r_off
=
0
;
...
@@ -63,14 +63,10 @@ int lxc_ringbuf_create(struct lxc_ringbuf *buf, size_t size)
...
@@ -63,14 +63,10 @@ int lxc_ringbuf_create(struct lxc_ringbuf *buf, size_t size)
if
(
tmp
==
MAP_FAILED
||
tmp
!=
(
buf
->
addr
+
buf
->
size
))
if
(
tmp
==
MAP_FAILED
||
tmp
!=
(
buf
->
addr
+
buf
->
size
))
goto
on_error
;
goto
on_error
;
close
(
memfd
);
return
0
;
return
0
;
on_error:
on_error:
lxc_ringbuf_release
(
buf
);
lxc_ringbuf_release
(
buf
);
if
(
memfd
>=
0
)
close
(
memfd
);
return
-
1
;
return
-
1
;
}
}
...
...
src/lxc/ringbuf.h
View file @
55cf04e3
...
@@ -36,7 +36,8 @@ extern int lxc_ringbuf_read(struct lxc_ringbuf *buf, char *out, size_t *len);
...
@@ -36,7 +36,8 @@ extern int lxc_ringbuf_read(struct lxc_ringbuf *buf, char *out, size_t *len);
static
inline
void
lxc_ringbuf_release
(
struct
lxc_ringbuf
*
buf
)
static
inline
void
lxc_ringbuf_release
(
struct
lxc_ringbuf
*
buf
)
{
{
munmap
(
buf
->
addr
,
buf
->
size
*
2
);
if
(
buf
->
addr
)
munmap
(
buf
->
addr
,
buf
->
size
*
2
);
}
}
static
inline
void
lxc_ringbuf_clear
(
struct
lxc_ringbuf
*
buf
)
static
inline
void
lxc_ringbuf_clear
(
struct
lxc_ringbuf
*
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