Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
metadata-collect-agent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
metadata-collect-agent
Commits
cbf028f3
Commit
cbf028f3
authored
Feb 08, 2022
by
Ophélie Gagnard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/main.*: Improve arguments handling.
parent
db8dcfd0
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
230 additions
and
122 deletions
+230
-122
src/main.cpp
src/main.cpp
+220
-119
src/main.pyx
src/main.pyx
+10
-3
No files found.
src/main.cpp
View file @
cbf028f3
This diff is collapsed.
Click to expand it.
src/main.pyx
View file @
cbf028f3
...
...
@@ -281,6 +281,11 @@ cdef int start(const char *path_to_scan, const char *fb_exec_path, const char *f
#cdef char ip_address[100]
#cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
if
child_pid
==
0
:
# CHILD
fprintf
(
stdout
,
"path_to_scan: %s
\
n
"
,
path_to_scan
)
fprintf
(
stdout
,
"fb_exec_path: %s
\
n
"
,
fb_exec_path
)
fprintf
(
stdout
,
"fb_lib_path: %s
\
n
"
,
fb_lib_path
)
fprintf
(
stdout
,
"fb_conf_path: %s
\
n
"
,
fb_conf_path
)
fprintf
(
stdout
,
"log_path: %s
\
n
"
,
log_path
)
err
=
execlp
(
fb_exec_path
,
program_name
,
<
char
*>
"-e"
,
fb_lib_path
,
<
char
*>
"-c"
,
fb_conf_path
,
0
)
fprintf
(
stderr
,
"ERROR with execlp() in CHILD: %d
\
n
"
,
err
)
else
:
# PARENT
...
...
@@ -363,13 +368,15 @@ cdef public int main(int argc, char* argv[]) nogil:
cdef
char
*
fb_lib_path
=
"/etc/fluentbit_wendelin.so"
cdef
char
*
fb_conf_path
=
"/etc/flb.conf"
cdef
char
*
log_path
=
"/var/log/metadata_collect.log"
if
argc
==
2
:
path_to_scan
=
<
char
*>
argv
[
1
]
elif
argc
==
6
:
if
argc
>=
2
:
path_to_scan
=
<
char
*>
argv
[
1
]
if
argc
>=
3
:
fb_exec_path
=
<
char
*>
argv
[
2
]
if
argc
>=
4
:
fb_lib_path
=
<
char
*>
argv
[
3
]
if
argc
>=
5
:
fb_conf_path
=
<
char
*>
argv
[
4
]
if
argc
>=
6
:
log_path
=
<
char
*>
argv
[
5
]
return
start
(
<
char
*>
path_to_scan
,
<
char
*>
fb_exec_path
,
<
char
*>
fb_lib_path
,
<
char
*>
fb_conf_path
,
<
char
*>
log_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