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
3fcae2e4
Unverified
Commit
3fcae2e4
authored
Feb 11, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
string_utils: convert to strnprintf()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
c66f3f43
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
string_utils.c
src/lxc/string_utils.c
+6
-8
No files found.
src/lxc/string_utils.c
View file @
3fcae2e4
...
@@ -276,9 +276,9 @@ char *lxc_deslashify(const char *path)
...
@@ -276,9 +276,9 @@ char *lxc_deslashify(const char *path)
char
*
lxc_append_paths
(
const
char
*
first
,
const
char
*
second
)
char
*
lxc_append_paths
(
const
char
*
first
,
const
char
*
second
)
{
{
__do_free
char
*
result
=
NULL
;
int
ret
;
int
ret
;
size_t
len
;
size_t
len
;
char
*
result
=
NULL
;
int
pattern_type
=
0
;
int
pattern_type
=
0
;
len
=
strlen
(
first
)
+
strlen
(
second
)
+
1
;
len
=
strlen
(
first
)
+
strlen
(
second
)
+
1
;
...
@@ -287,20 +287,18 @@ char *lxc_append_paths(const char *first, const char *second)
...
@@ -287,20 +287,18 @@ char *lxc_append_paths(const char *first, const char *second)
pattern_type
=
1
;
pattern_type
=
1
;
}
}
result
=
calloc
(
1
,
len
);
result
=
zalloc
(
len
);
if
(
!
result
)
if
(
!
result
)
return
NULL
;
return
NULL
;
if
(
pattern_type
==
0
)
if
(
pattern_type
==
0
)
ret
=
snprintf
(
result
,
len
,
"%s%s"
,
first
,
second
);
ret
=
s
tr
nprintf
(
result
,
len
,
"%s%s"
,
first
,
second
);
else
else
ret
=
snprintf
(
result
,
len
,
"%s/%s"
,
first
,
second
);
ret
=
strnprintf
(
result
,
len
,
"%s/%s"
,
first
,
second
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
len
)
{
if
(
ret
<
0
)
free
(
result
);
return
NULL
;
return
NULL
;
}
return
result
;
return
move_ptr
(
result
)
;
}
}
bool
lxc_string_in_list
(
const
char
*
needle
,
const
char
*
haystack
,
char
_sep
)
bool
lxc_string_in_list
(
const
char
*
needle
,
const
char
*
haystack
,
char
_sep
)
...
...
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