Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
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
savoirfairelinux
jami-daemon
Commits
ab4b9c86
Commit
ab4b9c86
authored
16 years ago
by
Yun Liu
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug ticket
#54
parent
0e8b1a82
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/global.h
+1
-1
1 addition, 1 deletion
src/global.h
src/main.cpp
+38
-1
38 additions, 1 deletion
src/main.cpp
with
39 additions
and
2 deletions
src/global.h
+
1
−
1
View file @
ab4b9c86
...
...
@@ -35,7 +35,7 @@ typedef short int16;
#define ASSERT( expected , value) if( value == expected ) return SUCCESS; \
else return 1;
#define PIDFILE "sfl.pid"
#ifdef DATAFORMAT_IS_FLOAT
#define SFLDataFormat float32
#define SFLDataFormatString "Float32"
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
+
38
−
1
View file @
ab4b9c86
...
...
@@ -22,7 +22,7 @@
#include
<libintl.h>
#include
<cstring>
#include
<iostream>
#include
<string>
//#include "config.h"
#include
"global.h"
...
...
@@ -50,6 +50,43 @@ main (int argc, char **argv) {
printf
(
_
(
"See http://www.sflphone.org/ for more information
\n
"
));
}
else
{
FILE
*
fp
;
char
homepid
[
128
];
unsigned
int
iPid
=
getpid
();
char
cPid
[
64
],
cOldPid
[
64
];
sprintf
(
cPid
,
"%d"
,
iPid
);
sprintf
(
homepid
,
"%s/.%s/%s"
,
HOMEDIR
,
PROGDIR
,
PIDFILE
);
if
(
(
fp
=
fopen
(
homepid
,
"r"
))
==
NULL
){
//PID file doesn't exists, create and write pid in it
if
(
(
fp
=
fopen
(
homepid
,
"w"
))
==
NULL
){
fprintf
(
stderr
,
_
(
"Creating PID file %s failed. Exited.
\n
"
),
homepid
);
exit
(
-
1
);
}
else
{
fputs
(
cPid
,
fp
);
fclose
(
fp
);
}
}
else
{
// PID file exists. Check the former process still alive or not. If alive, kill it and start a new one.
fgets
(
cOldPid
,
64
,
fp
);
fclose
(
fp
);
if
(
kill
(
atoi
(
cOldPid
),
0
)
==
SUCCESS
)
{
fprintf
(
stderr
,
_
(
"There is already a sflphoned daemon running in the system. Starting Failed.
\n
"
));
exit
(
-
1
);
}
else
{
if
(
(
fp
=
fopen
(
homepid
,
"w"
))
==
NULL
){
fprintf
(
stderr
,
_
(
"Writing to PID file %s failed. Exited.
\n
"
),
homepid
);
exit
(
-
1
);
}
else
{
fputs
(
cPid
,
fp
);
fclose
(
fp
);
}
}
}
int
sessionPort
=
0
;
if
(
argc
==
2
)
{
char
*
ptrPort
=
strstr
(
argv
[
1
],
"--port="
);
...
...
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