Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fanout
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
fanout
Commits
583ff24f
Commit
583ff24f
authored
11 years ago
by
elliotkendall
Browse files
Options
Downloads
Patches
Plain Diff
Only open the pid file if we're going to use it
parent
547cf242
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
fanout.c
+7
-4
7 additions, 4 deletions
fanout.c
with
7 additions
and
4 deletions
fanout.c
+
7
−
4
View file @
583ff24f
...
...
@@ -158,7 +158,7 @@ int main (int argc, char *argv[])
socklen_t
optlen
=
sizeof
(
optval
);
u_int
listen_backlog
=
25
;
u_int
max_events
=
25
;
FILE
*
pidfile
=
NULL
;
char
*
pidfile
name
;
server_start_time
=
(
long
)
time
(
NULL
);
char
buffer
[
1025
];
...
...
@@ -215,9 +215,7 @@ int main (int argc, char *argv[])
break
;
// pidfile
case
3
:
if
((
pidfile
=
fopen
(
optarg
,
"w+"
))
==
NULL
)
{
fanout_error
(
"ERROR cannot open pidfile"
);
}
pidfilename
=
optarg
;
break
;
//daemon
case
4
:
...
...
@@ -398,9 +396,14 @@ xit\n");
we can exit the parent process. */
if
(
pid
>
0
)
{
/* Write pid to file */
FILE
*
pidfile
=
NULL
;
pidfile
=
fopen
(
pidfilename
,
"w+"
);
if
(
pidfile
!=
NULL
)
{
fprintf
(
pidfile
,
"%d
\n
"
,
(
int
)
pid
);
fclose
(
pidfile
);
}
else
{
fanout_error
(
"ERROR cannot open pidfile"
);
exit
(
EXIT_FAILURE
);
}
exit
(
EXIT_SUCCESS
);
}
...
...
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