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
f0c6219a
Unverified
Commit
f0c6219a
authored
Apr 07, 2021
by
Stéphane Graber
Committed by
GitHub
Apr 07, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3773 from brauner/2021-04-06/fixes_2
confile & log: fixes
parents
9d984c3f
ae393e13
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
8 deletions
+29
-8
confile.c
src/lxc/confile.c
+18
-4
log.h
src/lxc/log.h
+7
-0
macro.h
src/lxc/macro.h
+4
-4
No files found.
src/lxc/confile.c
View file @
f0c6219a
...
@@ -300,12 +300,22 @@ struct lxc_config_t *lxc_get_config_exact(const char *key)
...
@@ -300,12 +300,22 @@ struct lxc_config_t *lxc_get_config_exact(const char *key)
return
NULL
;
return
NULL
;
}
}
static
inline
bool
match_config_item
(
const
struct
lxc_config_t
*
entry
,
/* Assume a reasonable subkey size limit. */
const
char
*
key
)
#define LXC_SUBKEY_LEN_MAX 256
static
inline
int
match_config_item
(
const
struct
lxc_config_t
*
entry
,
const
char
*
key
)
{
{
size_t
len
;
if
(
entry
->
strict
)
if
(
entry
->
strict
)
return
strequal
(
entry
->
name
,
key
);
return
strequal
(
entry
->
name
,
key
);
return
strnequal
(
entry
->
name
,
key
,
strlen
(
entry
->
name
));
/* There should be no subkey longer than this. */
len
=
strnlen
(
entry
->
name
,
LXC_SUBKEY_LEN_MAX
);
if
(
len
==
LXC_SUBKEY_LEN_MAX
)
return
error_ret
(
-
E2BIG
,
"Excessive subkey length"
);
return
strnequal
(
entry
->
name
,
key
,
len
);
}
}
struct
lxc_config_t
*
lxc_get_config
(
const
char
*
key
)
struct
lxc_config_t
*
lxc_get_config
(
const
char
*
key
)
...
@@ -313,8 +323,12 @@ struct lxc_config_t *lxc_get_config(const char *key)
...
@@ -313,8 +323,12 @@ struct lxc_config_t *lxc_get_config(const char *key)
for
(
size_t
i
=
0
;
i
<
ARRAY_SIZE
(
config_jump_table
);
i
++
)
{
for
(
size_t
i
=
0
;
i
<
ARRAY_SIZE
(
config_jump_table
);
i
++
)
{
struct
lxc_config_t
*
cur
=
&
config_jump_table
[
i
];
struct
lxc_config_t
*
cur
=
&
config_jump_table
[
i
];
if
(
!
match_config_item
(
cur
,
key
))
switch
(
match_config_item
(
cur
,
key
))
{
case
0
:
continue
;
continue
;
case
-
E2BIG
:
return
NULL
;
}
return
cur
;
return
cur
;
}
}
...
...
src/lxc/log.h
View file @
f0c6219a
...
@@ -583,6 +583,13 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
...
@@ -583,6 +583,13 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
__internal_ret__; \
__internal_ret__; \
})
})
#define error_ret(__ret__, format, ...) \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
ERROR(format, ##__VA_ARGS__); \
__internal_ret__; \
})
#define syswarn(format, ...) \
#define syswarn(format, ...) \
({ \
({ \
SYSWARN(format, ##__VA_ARGS__); \
SYSWARN(format, ##__VA_ARGS__); \
...
...
src/lxc/macro.h
View file @
f0c6219a
...
@@ -663,10 +663,10 @@ enum {
...
@@ -663,10 +663,10 @@ enum {
__internal_ret__; \
__internal_ret__; \
})
})
#define ret_errno(__errno__) \
#define ret_errno(__errno__)
\
({ \
({
\
errno = (__errno__); \
errno =
labs
(__errno__); \
-
(__errno__);
\
-
errno;
\
})
})
/* Container's specific file/directory names */
/* Container's specific file/directory names */
...
...
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