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
e342087c
Commit
e342087c
authored
4 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
fix memory allocation,fix symlink target
parent
ca2652f5
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/ss_environ.c
+15
-9
15 additions, 9 deletions
src/lib66/ss_environ.c
with
15 additions
and
9 deletions
src/lib66/ss_environ.c
+
15
−
9
View file @
e342087c
...
...
@@ -162,7 +162,6 @@ int env_make_symlink(stralloc *dst,stralloc *old_dst,sv_alltype *sv,uint8_t conf
char
*
version
=
keep
.
s
+
sv
->
cname
.
version
;
char
old
[
dst
->
len
+
5
]
;
//.old
char
dori
[
dst
->
len
+
1
]
;
char
dname
[
dst
->
len
+
1
]
;
char
current_version
[
dst
->
len
+
1
]
;
char
sym_version
[
dst
->
len
+
SS_SYM_VERSION_LEN
+
1
]
;
auto_strings
(
sym_version
,
dst
->
s
,
SS_SYM_VERSION
)
;
...
...
@@ -173,7 +172,7 @@ int env_make_symlink(stralloc *dst,stralloc *old_dst,sv_alltype *sv,uint8_t conf
r
=
scan_mode
(
dst
->
s
,
S_IFDIR
)
;
/** enforce to pass to new format*/
if
(
r
==
-
1
)
{
/** last
tim
e to pass to the new format. 0.6.0.0 or higher
/** last
chanc
e to pass to the new format. 0.6.0.0 or higher
* version will remove this check */
auto_strings
(
old
,
dst
->
s
,
".old"
)
;
if
(
rename
(
dst
->
s
,
old
)
==
-
1
)
...
...
@@ -191,24 +190,30 @@ int env_make_symlink(stralloc *dst,stralloc *old_dst,sv_alltype *sv,uint8_t conf
if
(
sarealpath
(
&
saversion
,
sym_version
)
==
-
1
)
log_warn_return
(
LOG_EXIT_ZERO
,
"sarealpath of: "
,
sym_version
)
;
char
dname
[
saversion
.
len
+
1
]
;
r
=
scan_mode
(
saversion
.
s
,
S_IFREG
)
;
if
(
r
>
0
)
{
/** /etc/66/conf/service/version/confile */
if
(
!
ob_dirname
(
dname
,
saversion
.
s
))
log_warn_return
(
LOG_EXIT_ZERO
,
"get basename of: "
,
saversion
.
s
)
;
dname
[
strlen
(
dname
)
-
1
]
=
0
;
dname
[
strlen
(
dname
)
-
1
]
=
0
;
saversion
.
len
=
0
;
if
(
!
auto_stra
(
&
saversion
,
dname
))
log_warn_return
(
LOG_EXIT_ZERO
,
"stralloc"
)
;
if
(
!
ob_basename
(
current_version
,
dname
))
log_warn_return
(
LOG_EXIT_ZERO
,
"get basename of: "
,
dname
)
;
/** old format->point to a file instead of the directory,
* enforce to pass to new one */
if
(
!
atomic_symlink
(
dst
->
s
,
sym_version
,
"env_compute"
))
log_warnu_return
(
LOG_EXIT_ZERO
,
"symlink: "
,
sym_version
,
" to: "
,
dst
->
s
)
;
{
char
tmp
[
dst
->
len
+
strlen
(
current_version
)
+
2
]
;
auto_strings
(
tmp
,
dst
->
s
,
"/"
,
current_version
)
;
/** old format->point to a file instead of the directory,
* enforce to pass to new one */
if
(
!
atomic_symlink
(
tmp
,
sym_version
,
"env_compute"
))
log_warnu_return
(
LOG_EXIT_ZERO
,
"symlink: "
,
sym_version
,
" to: "
,
dst
->
s
)
;
}
}
else
{
...
...
@@ -274,7 +279,7 @@ int env_make_symlink(stralloc *dst,stralloc *old_dst,sv_alltype *sv,uint8_t conf
if
(
!
auto_stra
(
dst
,
SS_SYM_VERSION
))
log_warnsys_return
(
LOG_EXIT_ZERO
,
"stralloc"
)
;
}
printf
(
"dori:2:%s
\n
"
,
dori
)
;
saversion
.
len
=
0
;
if
(
!
auto_stra
(
&
saversion
,
dori
,
"/"
,
version
,
"/"
,
name
))
log_warn_return
(
LOG_EXIT_ZERO
,
"stralloc"
)
;
...
...
@@ -285,6 +290,7 @@ int env_make_symlink(stralloc *dst,stralloc *old_dst,sv_alltype *sv,uint8_t conf
/** New version doesn't exist yet, we create it even
* if the symlink is not updated */
saversion
.
len
=
0
;
printf
(
"dori::%s
\n
"
,
dori
)
;
if
(
!
auto_stra
(
&
saversion
,
dori
,
"/"
,
version
))
log_warn_return
(
LOG_EXIT_ZERO
,
"stralloc"
)
;
if
(
!
dir_create_parent
(
saversion
.
s
,
0755
))
...
...
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