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
d8fd2ada
Commit
d8fd2ada
authored
2 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
use existing name checker
parent
177f2267
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib66/exec/ssexec_disable.c
+2
-12
2 additions, 12 deletions
src/lib66/exec/ssexec_disable.c
src/lib66/exec/ssexec_enable.c
+2
-12
2 additions, 12 deletions
src/lib66/exec/ssexec_enable.c
with
4 additions
and
24 deletions
src/lib66/exec/ssexec_disable.c
+
2
−
12
View file @
d8fd2ada
...
...
@@ -29,17 +29,7 @@
#include
<66/service.h>
#include
<66/graph.h>
#include
<66/resolve.h>
static
void
check_identifier
(
char
const
*
name
)
{
log_flow
()
;
int
logname
=
get_rstrlen_until
(
name
,
SS_LOG_SUFFIX
)
;
if
(
logname
>
0
)
log_die
(
LOG_EXIT_USER
,
"service: "
,
name
,
": ends with reserved suffix -log"
)
;
if
(
!
memcmp
(
name
,
SS_MASTER
+
1
,
6
))
log_die
(
LOG_EXIT_USER
,
"service: "
,
name
,
": starts with reserved prefix Master"
)
;
if
(
!
strcmp
(
name
,
SS_SERVICE
))
log_die
(
LOG_EXIT_USER
,
"service as service name is a reserved name"
)
;
if
(
!
strcmp
(
name
,
"service@"
))
log_die
(
LOG_EXIT_USER
,
"service@ as service name is a reserved name"
)
;
}
#include
<66/utils.h>
int
ssexec_disable
(
int
argc
,
char
const
*
const
*
argv
,
ssexec_t
*
info
)
{
...
...
@@ -104,7 +94,7 @@ int ssexec_disable(int argc, char const *const *argv, ssexec_t *info)
log_die
(
LOG_EXIT_USER
,
"services selection is not available -- try to parse it first"
)
;
for
(;
n
<
argc
;
n
++
)
{
check_identifier
(
argv
[
n
])
;
name_isvalid
(
argv
[
n
])
;
service_enable_disable
(
&
graph
,
info
->
base
.
s
,
argv
[
n
],
0
)
;
if
(
!
sastr_add_string
(
&
sa
,
argv
[
n
]))
...
...
This diff is collapsed.
Click to expand it.
src/lib66/exec/ssexec_enable.c
+
2
−
12
View file @
d8fd2ada
...
...
@@ -30,17 +30,7 @@
#include
<66/config.h>
#include
<66/state.h>
#include
<66/resolve.h>
static
void
check_identifier
(
char
const
*
name
)
{
log_flow
()
;
int
logname
=
get_rstrlen_until
(
name
,
SS_LOG_SUFFIX
)
;
if
(
logname
>
0
)
log_die
(
LOG_EXIT_USER
,
"service: "
,
name
,
": ends with reserved suffix -log"
)
;
if
(
!
memcmp
(
name
,
SS_MASTER
+
1
,
6
))
log_die
(
LOG_EXIT_USER
,
"service: "
,
name
,
": starts with reserved prefix Master"
)
;
if
(
!
strcmp
(
name
,
SS_SERVICE
))
log_die
(
LOG_EXIT_USER
,
"service as service name is a reserved name"
)
;
if
(
!
strcmp
(
name
,
"service@"
))
log_die
(
LOG_EXIT_USER
,
"service@ as service name is a reserved name"
)
;
}
#include
<66/utils.h>
static
void
parse_it
(
char
const
*
name
,
uint8_t
force
,
uint8_t
conf
,
ssexec_t
*
info
)
{
...
...
@@ -131,7 +121,7 @@ int ssexec_enable(int argc, char const *const *argv, ssexec_t *info)
log_usage
(
info
->
usage
,
"
\n
"
,
info
->
help
)
;
for
(;
n
<
argc
;
n
++
)
{
check_identifier
(
argv
[
n
])
;
name_isvalid
(
argv
[
n
])
;
parse_it
(
argv
[
n
],
force
,
conf
,
info
)
;
}
...
...
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