Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
462f6a76
Commit
462f6a76
authored
Dec 11, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error handling during initialisation.
parent
95493899
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
babel.c
babel.c
+12
-12
No files found.
babel.c
View file @
462f6a76
...
...
@@ -284,19 +284,19 @@ main(int argc, char **argv)
rc
=
reopen_logfile
();
if
(
rc
<
0
)
{
perror
(
"reopen_logfile()"
);
goto
fail
;
exit
(
1
)
;
}
fd
=
open
(
"/dev/null"
,
O_RDONLY
);
if
(
fd
<
0
)
{
perror
(
"open(null)"
);
goto
fail
;
exit
(
1
)
;
}
rc
=
dup2
(
fd
,
0
);
if
(
rc
<
0
)
{
perror
(
"dup2(null, 0)"
);
goto
fail
;
exit
(
1
)
;
}
close
(
fd
);
...
...
@@ -305,7 +305,7 @@ main(int argc, char **argv)
rc
=
daemonise
();
if
(
rc
<
0
)
{
perror
(
"daemonise"
);
goto
fail_nopid
;
exit
(
1
)
;
}
}
...
...
@@ -316,7 +316,7 @@ main(int argc, char **argv)
len
=
snprintf
(
buf
,
100
,
"%lu"
,
(
unsigned
long
)
getpid
());
if
(
len
<
0
||
len
>=
100
)
{
perror
(
"snprintf(getpid)"
);
goto
fail_nopid
;
exit
(
1
)
;
}
pfd
=
open
(
pidfile
,
O_WRONLY
|
O_CREAT
|
O_EXCL
,
0644
);
...
...
@@ -325,13 +325,13 @@ main(int argc, char **argv)
snprintf
(
buf
,
40
,
"creat(%s)"
,
pidfile
);
buf
[
39
]
=
'\0'
;
perror
(
buf
);
goto
fail_nopid
;
exit
(
1
)
;
}
rc
=
write
(
pfd
,
buf
,
len
);
if
(
rc
<
len
)
{
perror
(
"write(pidfile)"
);
goto
fail
;
goto
fail
_pid
;
}
close
(
pfd
);
...
...
@@ -340,14 +340,14 @@ main(int argc, char **argv)
rc
=
kernel_setup
(
1
);
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"kernel_setup failed.
\n
"
);
exit
(
1
)
;
goto
fail_pid
;
}
rc
=
kernel_setup_socket
(
1
);
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"kernel_setup_socket failed.
\n
"
);
kernel_setup
(
0
);
exit
(
1
)
;
goto
fail_pid
;
}
{
...
...
@@ -801,9 +801,6 @@ main(int argc, char **argv)
exit
(
1
);
fail:
if
(
pidfile
)
unlink
(
pidfile
);
fail_nopid:
FOR_ALL_NETS
(
net
)
{
if
(
!
net
->
up
)
continue
;
...
...
@@ -811,6 +808,9 @@ main(int argc, char **argv)
}
kernel_setup_socket
(
0
);
kernel_setup
(
0
);
fail_pid:
if
(
pidfile
)
unlink
(
pidfile
);
exit
(
1
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment