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
685b582e
Commit
685b582e
authored
1 year ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
remove foreground option
parent
68b7b47f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/include/66/ssexec.h
+1
-1
1 addition, 1 deletion
src/include/66/ssexec.h
src/lib66/exec/ssexec_help.c
+1
-2
1 addition, 2 deletions
src/lib66/exec/ssexec_help.c
src/lib66/exec/ssexec_scandir_signal.c
+3
-91
3 additions, 91 deletions
src/lib66/exec/ssexec_scandir_signal.c
with
5 additions
and
94 deletions
src/include/66/ssexec.h
+
1
−
1
View file @
685b582e
...
...
@@ -264,7 +264,7 @@ extern char const *help_halt ;
#define OPTS_SCANDIR_WRAPPER "ho:"
#define OPTS_SCANCTL_WRAPPER_LEN (sizeof OPTS_SCANDIR_WRAPPER - 1)
#define OPTS_SCANDIR_SIGNAL "d:s:e:bB
f
"
#define OPTS_SCANDIR_SIGNAL "d:s:e:bB"
#define OPTS_SCANDIR_SIGNAL_LEN (sizeof OPTS_SCANDIR_SIGNAL - 1)
#define OPTS_SCANDIR_CREATE "bBs:cL:"
#define OPTS_SCANDIR_CREATE_LEN (sizeof OPTS_SCANDIR_CREATE - 1)
...
...
This diff is collapsed.
Click to expand it.
src/lib66/exec/ssexec_help.c
+
1
−
2
View file @
685b582e
...
...
@@ -512,7 +512,7 @@ char const *help_scandir_remove =
" -h: print this help
\n
"
;
char
const
*
usage_scandir_start
=
"66 scandir start [ -h ] [ -d notif ] [ -s rescan ] [ -e environment ] [ -b|B
] [ -f
]"
;
char
const
*
usage_scandir_start
=
"66 scandir start [ -h ] [ -d notif ] [ -s rescan ] [ -e environment ] [ -b|B ]"
;
char
const
*
help_scandir_start
=
"
\n
start a scandir
\n
"
...
...
@@ -524,7 +524,6 @@ char const *help_scandir_start =
" -e: use environment as environment directory
\n
"
" -b: create scandir (if it not exist yet) for a boot process
\n
"
" -B: create scandir (if it not exist yet) for a boot process inside a container
\n
"
" -f: fork and become a daemon"
;
char
const
*
usage_scandir_stop
=
"66 scandir stop [ -h ]"
;
...
...
This diff is collapsed.
Click to expand it.
src/lib66/exec/ssexec_scandir_signal.c
+
3
−
91
View file @
685b582e
...
...
@@ -168,7 +168,7 @@ static int send_signal(char const *scandir, char const *signal)
return
svc_scandir_send
(
scandir
,
csig
)
;
}
static
void
scandir_up
(
char
const
*
scandir
,
unsigned
int
timeout
,
unsigned
int
notif
,
unsigned
int
foreground
,
char
const
*
const
*
envp
,
ssexec_t
*
info
)
static
void
scandir_up
(
char
const
*
scandir
,
unsigned
int
timeout
,
unsigned
int
notif
,
char
const
*
const
*
envp
,
ssexec_t
*
info
)
{
uid_t
uid
=
getuid
()
;
gid_t
gid
=
getgid
()
;
...
...
@@ -191,88 +191,6 @@ static void scandir_up(char const *scandir, unsigned int timeout, unsigned int n
newup
[
m
++
]
=
scandir
;
newup
[
m
++
]
=
0
;
if
(
!
foreground
&&
info
->
owner
)
{
int
fd
;
char
*
target
=
"/dev/null"
;
char
home
[
SS_MAX_PATH_LEN
+
1
]
;
gid_t
gid
=
-
1
;
if
(
!
yourgid
(
&
gid
,
info
->
owner
))
log_dieusys
(
LOG_EXIT_SYS
,
"get gid"
)
;
if
(
!
set_ownerhome_stack_byuid
(
home
,
info
->
owner
))
log_dieusys
(
LOG_EXIT_SYS
,
"set home directory"
)
;
size_t
homelen
=
strlen
(
home
),
loglen
=
strlen
(
SS_LOGGER_USERDIR
)
;
char
file
[
homelen
+
loglen
+
1
+
SS_SCANDIR_LEN
+
1
+
SS_TREE_CURRENT_LEN
+
1
]
;
auto_strings
(
file
,
home
,
SS_LOGGER_USERDIR
,
"/"
,
SS_SCANDIR
)
;
if
(
!
dir_create_parent
(
file
,
755
))
log_dieusys
(
LOG_EXIT_SYS
,
"create directory: "
,
file
)
;
file
[
homelen
+
loglen
+
1
]
=
0
;
if
(
chown
(
file
,
info
->
owner
,
gid
)
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"chown: "
,
file
)
;
if
(
chmod
(
file
,
0755
)
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"chmod: "
,
file
)
;
auto_strings
(
file
+
homelen
+
loglen
+
1
,
SS_SCANDIR
)
;
if
(
chown
(
file
,
info
->
owner
,
gid
)
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"chown: "
,
file
)
;
if
(
chmod
(
file
,
0755
)
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"chmod: "
,
file
)
;
auto_strings
(
file
+
homelen
+
loglen
+
1
+
SS_SCANDIR_LEN
,
"/"
,
SS_TREE_CURRENT
)
;
pid_t
pid
=
fork
()
;
if
(
pid
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"fork"
)
;
else
if
(
pid
)
_exit
(
0
)
;
if
(
setsid
()
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"setsid"
)
;
pid
=
fork
()
;
if
(
pid
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"fork"
)
;
else
if
(
pid
)
_exit
(
0
)
;
if
((
chdir
(
"/"
))
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"chdir"
)
;
fd
=
open
(
target
,
O_RDONLY
)
;
if
(
fd
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"open "
,
target
)
;
if
(
dup2
(
fd
,
0
)
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"copy stdin to "
,
target
)
;
close
(
fd
)
;
fd
=
open
(
file
,
O_WRONLY
|
O_NONBLOCK
|
O_CREAT
|
O_APPEND
,
0700
)
;
if
(
fd
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"open file: "
,
file
)
;
if
(
dup2
(
fd
,
1
)
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"copy stdout to: "
,
file
)
;
close
(
fd
)
;
if
(
dup2
(
1
,
2
)
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"copy stderr to stdout"
)
;
if
(
chown
(
file
,
info
->
owner
,
gid
)
<
0
)
log_dieusys
(
LOG_EXIT_SYS
,
"chown: "
,
file
)
;
}
if
(
!
uid
&&
uid
!=
info
->
owner
)
{
/** -o <owner> was asked. Respect it
* a start the s6-svscan process with the
...
...
@@ -297,7 +215,7 @@ int ssexec_scandir_signal(int argc, char const *const *argv, ssexec_t *info)
int
r
;
unsigned
int
timeout
=
0
,
notif
=
0
,
sig
=
0
,
container
=
0
,
boot
=
0
,
foreground
=
0
;
unsigned
int
timeout
=
0
,
notif
=
0
,
sig
=
0
,
container
=
0
,
boot
=
0
;
char
const
*
newenv
[
MAXENV
+
1
]
;
char
const
*
const
*
genv
=
0
;
...
...
@@ -355,12 +273,6 @@ int ssexec_scandir_signal(int argc, char const *const *argv, ssexec_t *info)
break
;
case
'f'
:
foreground
=
1
;
break
;
default
:
log_usage
(
info
->
usage
,
"
\n
"
,
info
->
help
)
;
...
...
@@ -439,7 +351,7 @@ int ssexec_scandir_signal(int argc, char const *const *argv, ssexec_t *info)
return
0
;
}
scandir_up
(
scandir
,
timeout
,
notif
,
foreground
,
genv
,
info
)
;
scandir_up
(
scandir
,
timeout
,
notif
,
genv
,
info
)
;
}
r
=
svc_scandir_ok
(
info
->
scandir
.
s
)
;
...
...
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