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
119126b6
Commit
119126b6
authored
Feb 12, 2014
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coverity: Always check mkdir_p's return value
Signed-off-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
Acked-by:
Serge E. Hallyn
<
serge.hallyn@ubuntu.com
>
parent
57d2be54
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
conf.c
src/lxc/conf.c
+13
-7
No files found.
src/lxc/conf.c
View file @
119126b6
...
@@ -1051,7 +1051,7 @@ static int setup_rootfs_pivot_root(const char *rootfs, const char *pivotdir)
...
@@ -1051,7 +1051,7 @@ static int setup_rootfs_pivot_root(const char *rootfs, const char *pivotdir)
if
(
access
(
path
,
F_OK
))
{
if
(
access
(
path
,
F_OK
))
{
if
(
mkdir_p
(
path
,
0755
))
{
if
(
mkdir_p
(
path
,
0755
)
<
0
)
{
SYSERROR
(
"failed to create pivotdir '%s'"
,
path
);
SYSERROR
(
"failed to create pivotdir '%s'"
,
path
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1890,7 +1890,7 @@ static inline int mount_entry_on_systemfs(const struct mntent *mntent)
...
@@ -1890,7 +1890,7 @@ static inline int mount_entry_on_systemfs(const struct mntent *mntent)
char
*
pathdirname
=
NULL
;
char
*
pathdirname
=
NULL
;
if
(
hasmntopt
(
mntent
,
"create=dir"
))
{
if
(
hasmntopt
(
mntent
,
"create=dir"
))
{
if
(
!
mkdir_p
(
mntent
->
mnt_dir
,
0755
)
)
{
if
(
mkdir_p
(
mntent
->
mnt_dir
,
0755
)
<
0
)
{
WARN
(
"Failed to create mount target '%s'"
,
mntent
->
mnt_dir
);
WARN
(
"Failed to create mount target '%s'"
,
mntent
->
mnt_dir
);
ret
=
-
1
;
ret
=
-
1
;
}
}
...
@@ -1899,7 +1899,9 @@ static inline int mount_entry_on_systemfs(const struct mntent *mntent)
...
@@ -1899,7 +1899,9 @@ static inline int mount_entry_on_systemfs(const struct mntent *mntent)
if
(
hasmntopt
(
mntent
,
"create=file"
)
&&
access
(
mntent
->
mnt_dir
,
F_OK
))
{
if
(
hasmntopt
(
mntent
,
"create=file"
)
&&
access
(
mntent
->
mnt_dir
,
F_OK
))
{
pathdirname
=
strdup
(
mntent
->
mnt_dir
);
pathdirname
=
strdup
(
mntent
->
mnt_dir
);
pathdirname
=
dirname
(
pathdirname
);
pathdirname
=
dirname
(
pathdirname
);
mkdir_p
(
pathdirname
,
0755
);
if
(
mkdir_p
(
pathdirname
,
0755
)
<
0
)
{
WARN
(
"Failed to create target directory"
);
}
pathfile
=
fopen
(
mntent
->
mnt_dir
,
"wb"
);
pathfile
=
fopen
(
mntent
->
mnt_dir
,
"wb"
);
if
(
!
pathfile
)
{
if
(
!
pathfile
)
{
WARN
(
"Failed to create mount target '%s'"
,
mntent
->
mnt_dir
);
WARN
(
"Failed to create mount target '%s'"
,
mntent
->
mnt_dir
);
...
@@ -1976,7 +1978,7 @@ skipabs:
...
@@ -1976,7 +1978,7 @@ skipabs:
}
}
if
(
hasmntopt
(
mntent
,
"create=dir"
))
{
if
(
hasmntopt
(
mntent
,
"create=dir"
))
{
if
(
!
mkdir_p
(
path
,
0755
)
)
{
if
(
mkdir_p
(
path
,
0755
)
<
0
)
{
WARN
(
"Failed to create mount target '%s'"
,
path
);
WARN
(
"Failed to create mount target '%s'"
,
path
);
ret
=
-
1
;
ret
=
-
1
;
}
}
...
@@ -1985,7 +1987,9 @@ skipabs:
...
@@ -1985,7 +1987,9 @@ skipabs:
if
(
hasmntopt
(
mntent
,
"create=file"
)
&&
access
(
path
,
F_OK
))
{
if
(
hasmntopt
(
mntent
,
"create=file"
)
&&
access
(
path
,
F_OK
))
{
pathdirname
=
strdup
(
path
);
pathdirname
=
strdup
(
path
);
pathdirname
=
dirname
(
pathdirname
);
pathdirname
=
dirname
(
pathdirname
);
mkdir_p
(
pathdirname
,
0755
);
if
(
mkdir_p
(
pathdirname
,
0755
)
<
0
)
{
WARN
(
"Failed to create target directory"
);
}
pathfile
=
fopen
(
path
,
"wb"
);
pathfile
=
fopen
(
path
,
"wb"
);
if
(
!
pathfile
)
{
if
(
!
pathfile
)
{
WARN
(
"Failed to create mount target '%s'"
,
path
);
WARN
(
"Failed to create mount target '%s'"
,
path
);
...
@@ -2031,7 +2035,7 @@ static int mount_entry_on_relative_rootfs(const struct mntent *mntent,
...
@@ -2031,7 +2035,7 @@ static int mount_entry_on_relative_rootfs(const struct mntent *mntent,
}
}
if
(
hasmntopt
(
mntent
,
"create=dir"
))
{
if
(
hasmntopt
(
mntent
,
"create=dir"
))
{
if
(
!
mkdir_p
(
path
,
0755
)
)
{
if
(
mkdir_p
(
path
,
0755
)
<
0
)
{
WARN
(
"Failed to create mount target '%s'"
,
path
);
WARN
(
"Failed to create mount target '%s'"
,
path
);
ret
=
-
1
;
ret
=
-
1
;
}
}
...
@@ -2040,7 +2044,9 @@ static int mount_entry_on_relative_rootfs(const struct mntent *mntent,
...
@@ -2040,7 +2044,9 @@ static int mount_entry_on_relative_rootfs(const struct mntent *mntent,
if
(
hasmntopt
(
mntent
,
"create=file"
)
&&
access
(
path
,
F_OK
))
{
if
(
hasmntopt
(
mntent
,
"create=file"
)
&&
access
(
path
,
F_OK
))
{
pathdirname
=
strdup
(
path
);
pathdirname
=
strdup
(
path
);
pathdirname
=
dirname
(
pathdirname
);
pathdirname
=
dirname
(
pathdirname
);
mkdir_p
(
pathdirname
,
0755
);
if
(
mkdir_p
(
pathdirname
,
0755
)
<
0
)
{
WARN
(
"Failed to create target directory"
);
}
pathfile
=
fopen
(
path
,
"wb"
);
pathfile
=
fopen
(
path
,
"wb"
);
if
(
!
pathfile
)
{
if
(
!
pathfile
)
{
WARN
(
"Failed to create mount target '%s'"
,
path
);
WARN
(
"Failed to create mount target '%s'"
,
path
);
...
...
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