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
cdae6186
Commit
cdae6186
authored
2 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
replace create_live function by create_live_state function
parent
0a4e6810
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/utils/create_live_state.c
+11
-19
11 additions, 19 deletions
src/lib66/utils/create_live_state.c
with
11 additions
and
19 deletions
src/lib66/utils/create_live.c
→
src/lib66/utils/create_live
_state
.c
+
11
−
19
View file @
cdae6186
/*
* create_live.c
* create_live
_state
.c
*
* Copyright (c) 2018-2021 Eric Vidal <eric@obarun.org>
*
...
...
@@ -13,7 +13,6 @@
*/
#include
<sys/types.h>
#include
<sys/stat.h>
#include
<unistd.h>
#include
<oblibs/log.h>
...
...
@@ -21,43 +20,36 @@
#include
<oblibs/types.h>
#include
<oblibs/directory.h>
#include
<skalibs/types.h>
#include
<66/ssexec.h>
#include
<66/utils.h>
#include
<66/tree.h>
#include
<66/resolve.h>
#include
<66/constants.h>
int
create_live
(
ssexec_t
*
info
)
int
create_live
_state
(
ssexec_t
*
info
,
char
const
*
treename
)
{
log_flow
()
;
int
r
;
char
ownerstr
[
UID_FMT
]
;
size_t
ownerlen
=
uid_fmt
(
ownerstr
,
info
->
owner
)
;
size_t
stelen
=
info
->
live
.
len
+
SS_STATE_LEN
+
1
+
ownerlen
+
1
+
info
->
treename
.
len
;
gid_t
gidowner
;
char
ste
[
stelen
+
1
]
;
ownerstr
[
ownerlen
]
=
0
;
size_t
treenamelen
=
strlen
(
treename
)
;
char
ste
[
info
->
live
.
len
+
SS_STATE_LEN
+
1
+
info
->
ownerlen
+
1
+
treenamelen
+
1
]
;
if
(
!
yourgid
(
&
gidowner
,
info
->
owner
))
log_warnusys_return
(
LOG_EXIT_ZERO
,
"get gid of: "
,
ownerstr
)
;
if
(
!
yourgid
(
&
gidowner
,
info
->
owner
))
log_warnusys_return
(
LOG_EXIT_ZERO
,
"get gid of: "
,
info
->
ownerstr
)
;
auto_strings
(
ste
,
info
->
live
.
s
,
SS_STATE
+
1
,
"/"
,
ownerstr
,
"/"
,
info
->
treename
.
s
)
;
auto_strings
(
ste
,
info
->
live
.
s
,
SS_STATE
+
1
,
"/"
,
info
->
ownerstr
,
"/"
,
treename
)
;
r
=
scan_mode
(
ste
,
S_IFDIR
)
;
if
(
r
<
0
)
return
0
;
if
(
r
<
0
)
log_warnsys_return
(
LOG_EXIT_ZERO
,
"conflicting format for: "
,
ste
)
;
if
(
!
r
)
{
r
=
dir_create_parent
(
ste
,
0700
)
;
if
(
!
r
)
log_warnusys_return
(
LOG_EXIT_ZERO
,
"create directory: "
,
ste
)
;
ste
[
info
->
live
.
len
+
SS_STATE_LEN
+
ownerlen
+
1
]
=
0
;
if
(
chown
(
ste
,
info
->
owner
,
gidowner
)
<
0
)
ste
[
info
->
live
.
len
+
SS_STATE_LEN
+
info
->
ownerlen
+
1
]
=
0
;
if
(
chown
(
ste
,
info
->
owner
,
gidowner
)
<
0
)
log_warnusys_return
(
LOG_EXIT_ZERO
,
"chown: "
,
ste
)
;
}
...
...
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