Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
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
Container 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
Main
Synchronet
Commits
f55c2e53
Commit
f55c2e53
authored
20 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Move daemon() into strn.cpp so it can be included in libsbbs.so if needed
parent
792b97e6
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/sbbs3/sbbscon.c
+0
-36
0 additions, 36 deletions
src/sbbs3/sbbscon.c
src/sbbs3/xtrn.cpp
+35
-0
35 additions, 0 deletions
src/sbbs3/xtrn.cpp
with
35 additions
and
36 deletions
src/sbbs3/sbbscon.c
+
0
−
36
View file @
f55c2e53
...
...
@@ -822,42 +822,6 @@ void _sighandler_rerun(int sig)
services_startup
.
recycle_now
=
TRUE
;
}
#ifdef NEEDS_DAEMON
/****************************************************************************/
/* Daemonizes the process */
/****************************************************************************/
int
daemon
(
nochdir
,
noclose
)
int
nochdir
,
noclose
;
{
int
fd
;
switch
(
fork
())
{
case
-
1
:
return
(
-
1
);
case
0
:
break
;
default:
_exit
(
0
);
}
if
(
setsid
()
==
-
1
)
return
(
-
1
);
if
(
!
nochdir
)
(
void
)
chdir
(
"/"
);
if
(
!
noclose
&&
(
fd
=
open
(
_PATH_DEVNULL
,
O_RDWR
,
0
))
!=
-
1
)
{
(
void
)
dup2
(
fd
,
STDIN_FILENO
);
(
void
)
dup2
(
fd
,
STDOUT_FILENO
);
(
void
)
dup2
(
fd
,
STDERR_FILENO
);
if
(
fd
>
2
)
(
void
)
close
(
fd
);
}
return
(
0
);
}
#endif
/* NEEDS_DAEMON */
static
void
handle_sigs
(
void
)
{
int
sig
;
sigset_t
sigs
;
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/xtrn.cpp
+
35
−
0
View file @
f55c2e53
...
...
@@ -1102,6 +1102,41 @@ static int login_tty(int fd)
return
(
0
);
}
#ifdef NEEDS_DAEMON
/****************************************************************************/
/* Daemonizes the process */
/****************************************************************************/
int
daemon
(
int
nochdir
,
int
noclose
)
{
int
fd
;
switch
(
fork
())
{
case
-
1
:
return
(
-
1
);
case
0
:
break
;
default:
_exit
(
0
);
}
if
(
setsid
()
==
-
1
)
return
(
-
1
);
if
(
!
nochdir
)
(
void
)
chdir
(
"/"
);
if
(
!
noclose
&&
(
fd
=
open
(
_PATH_DEVNULL
,
O_RDWR
,
0
))
!=
-
1
)
{
(
void
)
dup2
(
fd
,
STDIN_FILENO
);
(
void
)
dup2
(
fd
,
STDOUT_FILENO
);
(
void
)
dup2
(
fd
,
STDERR_FILENO
);
if
(
fd
>
2
)
(
void
)
close
(
fd
);
}
return
(
0
);
}
#endif
static
int
openpty
(
int
*
amaster
,
int
*
aslave
,
char
*
name
,
struct
termios
*
termp
,
winsize
*
winp
)
{
char
line
[]
=
"/dev/ptyXX"
;
...
...
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