Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ITS-Bridge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Plugtests
ITS Plugtests
ITS-Bridge
Commits
228baffe
Commit
228baffe
authored
4 years ago
by
Yann Garcia
Browse files
Options
Downloads
Patches
Plain Diff
Update config files
parent
4c66089e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
etc/openwrt/its_bridge/webserver.conf
+2
-2
2 additions, 2 deletions
etc/openwrt/its_bridge/webserver.conf
src/its_web_server_config.c
+2
-1
2 additions, 1 deletion
src/its_web_server_config.c
src/utils.c
+13
-7
13 additions, 7 deletions
src/utils.c
with
17 additions
and
10 deletions
etc/openwrt/its_bridge/webserver.conf
+
2
−
2
View file @
228baffe
...
...
@@ -4,6 +4,6 @@ realm=vendors
login
=
guest
password
=
password
https_port
=
8888
cert_pem
=/
etc
/
its_bridge
/
certs
/
server
.
pem
cert_key
=/
etc
/
its_bridge
/
certs
/
server
.
key
cert_pem
=/
etc
/
its_bridge
/
certs
/
its_bridge
.
pem
cert_key
=/
etc
/
its_bridge
/
certs
/
its_bridge
.
key
conf_path
=/
etc
/
its_bridge
This diff is collapsed.
Click to expand it.
src/its_web_server_config.c
+
2
−
1
View file @
228baffe
...
...
@@ -647,13 +647,14 @@ int32_t main(const int32_t p_argc, char* const p_argv[]) {
fprintf
(
stderr
,
"Failed to parse configuration file: conf_path missing, exit.
\n
"
);
goto
error
;
}
printf
(
"realm=%s, login=%s:%s, pem=%s, key=%s, conf_path=%s.
\n
"
,
realm
,
login
,
password
,
cert_pem
,
cert_key
,
conf_path
);
/* Daemonize */
if
(
daemonized
)
{
daemonize
();
}
printf
(
"realm=%s, login=%s:%s, pem=%s, key=%s, conf_path=%s.
\n
"
,
realm
,
login
,
password
,
cert_pem
,
cert_key
,
conf_path
);
/* Here is either the main process is not deamonized or th echild process if deamonized */
set_pid_file
(
PID_FILE_NAME
);
/* Set PID file */
set_lock_file
(
LOCK_FILE_NAME
);
/* Set lock file */
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
+
13
−
7
View file @
228baffe
...
...
@@ -349,11 +349,11 @@ void daemonize() {
}
if
(
pid
>
0
)
{
printf
(
"daemonize: parent exists.
\n
"
);
exit
(
0
);
exit
(
2
);
}
/* Child (daemon) continues */
printf
(
"daemonize: child started: %d.
\n
"
,
pid
);
printf
(
"daemonize: child started: %d.
\n
"
,
get
pid
()
);
if
(
setsid
()
<
0
)
{
/* Obtain a new process group */
fprintf
(
stderr
,
"daemonize: 'setsid' operation failure: %s.
\n
"
,
strerror
(
errno
));
exit
(
-
1
);
...
...
@@ -366,7 +366,7 @@ void daemonize() {
i
=
open
(
"/dev/null"
,
O_RDWR
);
/* Redirection of standards outputs */
dup
(
i
);
dup
(
i
);
umask
(
0
27
);
/* Set newly created file permissions */
umask
(
0
);
/* Set newly created file permissions */
/* Ignore part of signals */
signal
(
SIGCHLD
,
SIG_IGN
);
...
...
@@ -417,37 +417,43 @@ long get_file_size(const char *p_filename) {
if
((
0
!=
fseek
(
fp
,
0
,
SEEK_END
))
||
(
-
1
==
(
size
=
ftell
(
fp
))))
{
size
=
0
;
}
fclose
(
fp
);
fclose
(
fp
);
return
size
;
}
else
{
fprintf
(
stderr
,
"get_file_size: Failed to open file: %s.
\n
"
,
p_filename
);
}
return
0
;
}
char
*
load_file
(
const
char
*
p_filename
)
{
size_t
size
=
get_file_size
(
p_filename
);
size_t
size
=
get_file_size
(
p_filename
);
if
(
size
==
0
)
{
fprintf
(
stderr
,
"load_file: Wrong file size: %s.
\n
"
,
p_filename
);
return
NULL
;
}
FILE
*
fp
=
fopen
(
p_filename
,
"rb"
);
if
(
fp
==
NULL
)
{
fprintf
(
stderr
,
"load_file: Failed to open file: %s.
\n
"
,
strerror
(
errno
));
return
NULL
;
}
char
*
buffer
=
malloc
(
size
+
1
);
if
(
buffer
==
NULL
)
{
fprintf
(
stderr
,
"load_file: Failed to allocate memory: %s.
\n
"
,
strerror
(
errno
));
fclose
(
fp
);
return
NULL
;
}
buffer
[
size
]
=
'\0'
;
if
((
long
)
fread
(
buffer
,
1
,
size
,
fp
)
!=
size
)
{
if
((
long
)
fread
(
buffer
,
1
,
size
,
fp
)
!=
size
)
{
fprintf
(
stderr
,
"load_file: Failed to read file: %s.
\n
"
,
strerror
(
errno
));
free
(
buffer
);
buffer
=
NULL
;
}
fclose
(
fp
);
fclose
(
fp
);
return
buffer
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment