Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
6
66
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
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
Eric Vidal
66
Commits
32c5d501
Commit
32c5d501
authored
1 year ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
avoid to read twice the state file
parent
5f705942
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib66/sanitize/sanitize_init.c
+4
-3
4 additions, 3 deletions
src/lib66/sanitize/sanitize_init.c
with
4 additions
and
3 deletions
src/lib66/sanitize/sanitize_init.c
+
4
−
3
View file @
32c5d501
...
...
@@ -69,13 +69,13 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
if
(
!
state_read
(
&
sta
,
&
ares
[
aresid
]))
log_dieu
(
LOG_EXIT_SYS
,
"read state file of: "
,
name
)
;
earlier
=
s
ervice_is
(
&
sta
,
STATE_FLAGS_ISEARLIER
)
==
STATE_FLAGS_TRUE
?
1
:
0
;
earlier
=
s
ta
.
isearlier
==
STATE_FLAGS_TRUE
?
1
:
0
;
char
*
sa
=
ares
[
aresid
].
sa
.
s
;
char
*
scandir
=
sa
+
ares
[
aresid
].
live
.
scandir
;
size_t
scandirlen
=
strlen
(
scandir
)
;
is_init
=
access
(
sa
+
ares
[
aresid
].
live
.
statedir
,
F_OK
)
;
if
(
is_init
<
0
||
s
ervice_is
(
&
sta
,
STATE_FLAGS_TOINIT
)
==
STATE_FLAGS_TRUE
)
if
(
is_init
<
0
||
s
ta
.
toinit
==
STATE_FLAGS_TRUE
)
sanitize_livestate
(
&
ares
[
aresid
])
;
if
(
earlier
)
...
...
@@ -89,7 +89,7 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
is_supervised
=
access
(
scandir
,
F_OK
)
;
if
(
!
earlier
&&
!
is_supervised
)
{
log_
warn
(
name
,
" already initialized -- ignore it"
)
;
log_
trace
(
name
,
" already initialized -- ignore it"
)
;
msg
[
aresid
]
=
1
;
continue
;
}
...
...
@@ -107,6 +107,7 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
char
downfile
[
scandirlen
+
6
]
;
auto_strings
(
downfile
,
scandir
,
"/down"
)
;
log_trace
(
"create file: "
,
downfile
)
;
int
fd
=
open_trunc
(
downfile
)
;
if
(
fd
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"create file: "
,
downfile
)
;
...
...
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