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
c4382ee2
Unverified
Commit
c4382ee2
authored
Mar 01, 2019
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: remove fgets() from is_shared_mountpoint()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
f3d38164
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
utils.c
src/lxc/utils.c
+17
-16
No files found.
src/lxc/utils.c
View file @
c4382ee2
...
@@ -49,6 +49,7 @@
...
@@ -49,6 +49,7 @@
#include "config.h"
#include "config.h"
#include "log.h"
#include "log.h"
#include "lxclock.h"
#include "lxclock.h"
#include "memory_utils.h"
#include "namespace.h"
#include "namespace.h"
#include "parse.h"
#include "parse.h"
#include "raw_syscalls.h"
#include "raw_syscalls.h"
...
@@ -641,37 +642,37 @@ uint64_t fnv_64a_buf(void *buf, size_t len, uint64_t hval)
...
@@ -641,37 +642,37 @@ uint64_t fnv_64a_buf(void *buf, size_t len, uint64_t hval)
bool
is_shared_mountpoint
(
const
char
*
path
)
bool
is_shared_mountpoint
(
const
char
*
path
)
{
{
char
buf
[
LXC_LINELEN
]
;
__do_fclose
FILE
*
f
=
NULL
;
FILE
*
f
;
__do_free
char
*
line
=
NULL
;
int
i
;
int
i
;
char
*
p
,
*
p2
;
size_t
len
=
0
;
f
=
fopen
(
"/proc/self/mountinfo"
,
"r"
);
f
=
fopen
(
"/proc/self/mountinfo"
,
"r"
);
if
(
!
f
)
if
(
!
f
)
return
0
;
return
0
;
while
(
fgets
(
buf
,
LXC_LINELEN
,
f
))
{
while
(
getline
(
&
line
,
&
len
,
f
)
>
0
)
{
for
(
p
=
buf
,
i
=
0
;
p
&&
i
<
4
;
i
++
)
char
*
slider1
,
*
slider2
;
p
=
strchr
(
p
+
1
,
' '
);
if
(
!
p
)
for
(
slider1
=
line
,
i
=
0
;
slider1
&&
i
<
4
;
i
++
)
slider1
=
strchr
(
slider1
+
1
,
' '
);
if
(
!
slider1
)
continue
;
continue
;
p2
=
strchr
(
p
+
1
,
' '
);
slider2
=
strchr
(
slider1
+
1
,
' '
);
if
(
!
p
2
)
if
(
!
slider
2
)
continue
;
continue
;
*
p
2
=
'\0'
;
*
slider
2
=
'\0'
;
if
(
strcmp
(
p
+
1
,
path
)
==
0
)
{
if
(
strcmp
(
slider1
+
1
,
path
)
==
0
)
{
/* This is the path. Is it shared? */
/* This is the path. Is it shared? */
p
=
strchr
(
p2
+
1
,
' '
);
slider1
=
strchr
(
slider2
+
1
,
' '
);
if
(
p
&&
strstr
(
p
,
"shared:"
))
{
if
(
slider1
&&
strstr
(
slider1
,
"shared:"
))
fclose
(
f
);
return
true
;
return
true
;
}
}
}
}
}
fclose
(
f
);
return
false
;
return
false
;
}
}
...
...
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