Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
785cdb01
Commit
785cdb01
authored
Apr 02, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use EXIT_SUCCESS and EXIT_FAILURE
git-svn-id:
https://svn.musicpd.org/mpd/trunk@591
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
4f912f1b
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
87 additions
and
87 deletions
+87
-87
audio.c
src/audio.c
+6
-6
conf.c
src/conf.c
+7
-7
decode.c
src/decode.c
+2
-2
directory.c
src/directory.c
+9
-9
interface.c
src/interface.c
+4
-4
listen.c
src/listen.c
+3
-3
main.c
src/main.c
+32
-32
pcm_utils.c
src/pcm_utils.c
+2
-2
permission.c
src/permission.c
+3
-3
player.c
src/player.c
+1
-1
playerData.c
src/playerData.c
+6
-6
playlist.c
src/playlist.c
+8
-8
sig_handlers.c
src/sig_handlers.c
+1
-1
song.c
src/song.c
+2
-2
volume.c
src/volume.c
+1
-1
No files found.
src/audio.c
View file @
785cdb01
...
...
@@ -49,7 +49,7 @@ void initAudioDriver() {
if
(
*
test
!=
'\0'
)
{
ERROR
(
"
\"
%s
\"
is not a valid write size"
,
(
getConf
())[
CONF_AUDIO_WRITE_SIZE
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
audio_ao_options
=
NULL
;
...
...
@@ -62,13 +62,13 @@ void initAudioDriver() {
ao_driver_id
((
getConf
())[
CONF_AO_DRIVER
]))
<
0
)
{
ERROR
(
"
\"
%s
\"
is not a valid ao driver
\n
"
,
(
getConf
())[
CONF_AO_DRIVER
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
((
ai
=
ao_driver_info
(
audio_ao_driver_id
))
==
NULL
)
{
ERROR
(
"problems getting ao_driver_info
\n
"
);
ERROR
(
"you may not have permission to the audio device
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
dup
=
strdup
((
getConf
())[
CONF_AO_DRIVER_OPTIONS
]);
...
...
@@ -81,7 +81,7 @@ void initAudioDriver() {
if
(
!
key
)
{
ERROR
(
"problems parsing "
"ao_driver_options
\"
%s
\"\n
"
,
n1
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
/*found = 0;
for(i=0;i<ai->option_count;i++) {
...
...
@@ -94,13 +94,13 @@ void initAudioDriver() {
ERROR("\"%s\" is not an option for "
"\"%s\" ao driver\n",key,
ai->short_name);
exit(
-1
);
exit(
EXIT_FAILURE
);
}*/
value
=
strtok_r
(
NULL
,
""
,
&
stk2
);
if
(
!
value
)
{
ERROR
(
"problems parsing "
"ao_driver_options
\"
%s
\"\n
"
,
n1
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
ao_append_option
(
&
audio_ao_options
,
key
,
value
);
n1
=
strtok_r
(
NULL
,
";"
,
&
stk1
);
...
...
src/conf.c
View file @
785cdb01
...
...
@@ -160,7 +160,7 @@ char ** readConf(char * file) {
if
(
!
(
fp
=
fopen
(
file
,
"r"
)))
{
ERROR
(
"problems opening file %s for reading
\n
"
,
file
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
while
(
myFgets
(
string
,
sizeof
(
string
),
fp
))
{
...
...
@@ -169,13 +169,13 @@ char ** readConf(char * file) {
if
(
numberOfArgs
==
0
)
continue
;
if
(
2
!=
numberOfArgs
)
{
ERROR
(
"improperly formated config line: %s
\n
"
,
string
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
i
=
0
;
while
(
i
<
CONF_NUMBER_OF_PARAMS
&&
0
!=
strcmp
(
conf_strings
[
i
],
array
[
0
]))
i
++
;
if
(
i
>=
CONF_NUMBER_OF_PARAMS
)
{
ERROR
(
"unrecognized line in conf: %s
\n
"
,
string
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
conf_params
[
i
]
!=
NULL
)
{
if
(
allowCat
[
i
])
{
...
...
@@ -203,7 +203,7 @@ char ** readConf(char * file) {
if
(
conf_params
[
conf_required
[
i
]]
==
NULL
)
{
ERROR
(
"%s is unassigned in conf file
\n
"
,
conf_strings
[
conf_required
[
i
]]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
...
...
@@ -214,7 +214,7 @@ char ** readConf(char * file) {
{
ERROR
(
"
\"
%s
\"
is not an absolute path
\n
"
,
conf_params
[
conf_absolutePaths
[
i
]]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
/* Parse ~ in path */
else
if
(
conf_params
[
conf_absolutePaths
[
i
]]
&&
...
...
@@ -230,7 +230,7 @@ char ** readConf(char * file) {
if
((
pwd
=
getpwuid
(
uid
))
==
NULL
)
{
ERROR
(
"problems getting passwd entry "
"for current user
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
else
{
...
...
@@ -249,7 +249,7 @@ char ** readConf(char * file) {
ERROR
(
"user
\"
%s
\"
not found
\n
"
,
&
(
conf_params
[
conf_absolutePaths
[
i
]][
1
]));
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
foundSlash
)
*
ch
=
'/'
;
}
...
...
src/decode.c
View file @
785cdb01
...
...
@@ -70,7 +70,7 @@ void decodeSigHandler(int sig) {
int
pid
=
*
decode_pid
;
if
(
pid
>
0
)
kill
(
pid
,
SIGTERM
);
}
exit
(
0
);
exit
(
EXIT_SUCCESS
);
}
}
...
...
@@ -275,7 +275,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
else
my_usleep
(
10000
);
}
exit
(
0
);
exit
(
EXIT_SUCCESS
);
/* END OF CHILD */
}
else
if
(
pid
<
0
)
{
...
...
src/directory.c
View file @
785cdb01
...
...
@@ -444,21 +444,21 @@ void readDirectoryInfo(FILE * fp,Directory * directory) {
key
=
strdup
(
&
(
buffer
[
strlen
(
DIRECTORY_DIR
)]));
if
(
myFgets
(
buffer
,
bufferSize
,
fp
)
<
0
)
{
ERROR
(
"Error reading db
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
strncmp
(
DIRECTORY_MTIME
,
buffer
,
strlen
(
DIRECTORY_MTIME
)))
{
ERROR
(
"Error reading db
\n
"
);
ERROR
(
"%s
\n
"
,
buffer
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
mtime
=
atoi
(
&
(
buffer
[
strlen
(
DIRECTORY_BEGIN
)]));
if
(
myFgets
(
buffer
,
bufferSize
,
fp
)
<
0
)
{
ERROR
(
"Error reading db
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
strncmp
(
DIRECTORY_BEGIN
,
buffer
,
strlen
(
DIRECTORY_BEGIN
)))
{
ERROR
(
"Error reading db
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
name
=
strdup
(
&
(
buffer
[
strlen
(
DIRECTORY_BEGIN
)]));
subDirectory
=
newDirectory
(
directory
,
name
,
mtime
);
...
...
@@ -472,7 +472,7 @@ void readDirectoryInfo(FILE * fp,Directory * directory) {
}
else
{
ERROR
(
"Unknown line in db: %s
\n
"
,
buffer
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
}
...
...
@@ -529,7 +529,7 @@ int readDirectoryDB() {
if
(
myFgets
(
buffer
,
bufferSize
,
fp
)
<
0
)
{
ERROR
(
"Error reading db
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
0
==
strcmp
(
DIRECTORY_INFO_BEGIN
,
buffer
))
{
while
(
myFgets
(
buffer
,
bufferSize
,
fp
)
&&
...
...
@@ -541,7 +541,7 @@ int readDirectoryDB() {
if
(
foundVersion
)
{
ERROR
(
"already found "
"version in db
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
foundVersion
=
1
;
}
...
...
@@ -554,7 +554,7 @@ int readDirectoryDB() {
if
(
foundFsCharset
)
{
ERROR
(
"already found "
"fs charset in db
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
foundFsCharset
=
1
;
...
...
@@ -577,7 +577,7 @@ int readDirectoryDB() {
else
{
ERROR
(
"directory: unknown line in db info: %s
\n
"
,
buffer
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
}
...
...
src/interface.c
View file @
785cdb01
...
...
@@ -418,25 +418,25 @@ void initInterfaces() {
interface_timeout
=
strtol
((
getConf
())[
CONF_CONNECTION_TIMEOUT
],
&
test
,
10
);
if
(
*
test
!=
'\0'
||
interface_timeout
<=
0
)
{
ERROR
(
"connection timeout
\"
%s
\"
is not a positive integer
\n
"
,(
getConf
())[
CONF_CONNECTION_TIMEOUT
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
interface_max_connections
=
strtol
((
getConf
())[
CONF_MAX_CONNECTIONS
],
&
test
,
10
);
if
(
*
test
!=
'\0'
||
interface_max_connections
<=
0
)
{
ERROR
(
"max connections
\"
%s
\"
is not a positive integer
\n
"
,(
getConf
())[
CONF_MAX_CONNECTIONS
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
interface_max_command_list_size
=
strtoll
((
getConf
())[
CONF_MAX_COMMAND_LIST_SIZE
],
&
test
,
10
);
if
(
*
test
!=
'\0'
||
interface_max_command_list_size
<=
0
)
{
ERROR
(
"max command list size
\"
%s
\"
is not a positive integer
\n
"
,(
getConf
())[
CONF_MAX_COMMAND_LIST_SIZE
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
interface_max_output_buffer_size
=
strtoll
((
getConf
())[
CONF_MAX_OUTPUT_BUFFER_SIZE
],
&
test
,
10
);
if
(
*
test
!=
'\0'
||
interface_max_output_buffer_size
<=
0
)
{
ERROR
(
"max output buffer size
\"
%s
\"
is not a positive integer
\n
"
,(
getConf
())[
CONF_MAX_OUTPUT_BUFFER_SIZE
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
interface_max_command_list_size
*=
1024
;
...
...
src/listen.c
View file @
785cdb01
...
...
@@ -90,7 +90,7 @@ int establish(unsigned short port) {
if
(
!
(
he
=
gethostbyname
((
getConf
())[
CONF_BIND_TO_ADDRESS
])))
{
ERROR
(
"can't lookup host
\"
%s
\"\n
"
,
(
getConf
())[
CONF_BIND_TO_ADDRESS
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
switch
(
he
->
h_addrtype
)
{
#ifdef HAVE_IPV6
...
...
@@ -99,7 +99,7 @@ int establish(unsigned short port) {
ERROR
(
"no IPv6 support, but a IPv6 address "
"found for
\"
%s
\"\n
"
,
(
getConf
())[
CONF_BIND_TO_ADDRESS
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
bcopy
((
char
*
)
he
->
h_addr
,(
char
*
)
&
sin6
.
sin6_addr
.
s6_addr
,
he
->
h_length
);
...
...
@@ -116,7 +116,7 @@ int establish(unsigned short port) {
default:
ERROR
(
"address type for
\"
%s
\"
is not IPv4 or IPv6
\n
"
,
(
getConf
())[
CONF_BIND_TO_ADDRESS
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
...
...
src/main.c
View file @
785cdb01
...
...
@@ -99,7 +99,7 @@ void parseOptions(int argc, char ** argv, Options * options) {
if
(
strncmp
(
argv
[
i
],
"--"
,
2
)
==
0
)
{
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
)
{
usage
(
argv
);
exit
(
0
);
exit
(
EXIT_SUCCESS
);
}
else
if
(
strcmp
(
argv
[
i
],
"--no-daemon"
)
==
0
)
{
options
->
daemon
=
0
;
...
...
@@ -119,11 +119,11 @@ void parseOptions(int argc, char ** argv, Options * options) {
}
else
if
(
strcmp
(
argv
[
i
],
"--version"
)
==
0
)
{
version
();
exit
(
0
);
exit
(
EXIT_SUCCESS
);
}
else
{
myfprintf
(
stderr
,
"unknown command line option: %s
\n
"
,
argv
[
i
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
else
break
;
...
...
@@ -176,7 +176,7 @@ void parseOptions(int argc, char ** argv, Options * options) {
}
usage
(
argv
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -207,12 +207,12 @@ int main(int argc, char * argv[]) {
if
((
port
=
atoi
(
options
.
portStr
))
<
0
)
{
ERROR
(
"problem with port number
\n
"
);
return
-
1
;
return
EXIT_FAILURE
;
}
if
((
listenSocket
=
establish
(
port
))
<
0
)
{
ERROR
(
"error binding port
\n
"
);
return
-
1
;
return
EXIT_FAILURE
;
}
/*
...
...
@@ -229,7 +229,7 @@ int main(int argc, char * argv[]) {
struct
passwd
*
userpwd
;
if
((
userpwd
=
getpwnam
(
options
.
usr
))
==
NULL
)
{
ERROR
(
"no such user: %s
\n
"
,
options
.
usr
);
return
-
1
;
return
EXIT_FAILURE
;
}
uid
=
userpwd
->
pw_uid
;
gid
=
userpwd
->
pw_gid
;
...
...
@@ -237,7 +237,7 @@ int main(int argc, char * argv[]) {
if
(
setgid
(
gid
)
==
-
1
)
{
ERROR
(
"cannot setgid of user %s: %s
\n
"
,
options
.
usr
,
strerror
(
errno
));
return
-
1
;
return
EXIT_FAILURE
;
}
#ifdef _BSD_SOURCE
...
...
@@ -253,13 +253,13 @@ int main(int argc, char * argv[]) {
ERROR
(
"cannot get groups "
"of user %s: %s
\n
"
,
options
.
usr
,
strerror
(
errno
));
return
-
1
;
return
EXIT_FAILURE
;
}
else
if
(
setgroups
(
NGROUPS_MAX
,
gid_list
)
==
-
1
)
{
ERROR
(
"cannot set groups "
"of user %s: %s
\n
"
,
options
.
usr
,
strerror
(
errno
));
return
-
1
;
return
EXIT_FAILURE
;
}
#endif
...
...
@@ -268,7 +268,7 @@ int main(int argc, char * argv[]) {
ERROR
(
"cannot change to uid of user "
"%s: %s
\n
"
,
options
.
usr
,
strerror
(
errno
));
return
-
1
;
return
EXIT_FAILURE
;
}
}
...
...
@@ -276,13 +276,13 @@ int main(int argc, char * argv[]) {
if
(
NULL
==
(
out
=
fopen
(
options
.
logFile
,
"a"
)))
{
ERROR
(
"problem opening file
\"
%s
\"
for writing
\n
"
,
options
.
logFile
);
return
-
1
;
return
EXIT_FAILURE
;
}
if
(
NULL
==
(
err
=
fopen
(
options
.
errorFile
,
"a"
)))
{
ERROR
(
"problem opening file
\"
%s
\"
for writing
\n
"
,
options
.
errorFile
);
return
-
1
;
return
EXIT_FAILURE
;
}
initPaths
();
...
...
@@ -303,11 +303,11 @@ int main(int argc, char * argv[]) {
}
if
((
stat
(
playlistDir
,
&
st
))
<
0
)
{
ERROR
(
"problem stat'ing
\"
%s
\"\n
"
,
options
.
playlistDirArg
);
return
-
1
;
return
EXIT_FAILURE
;
}
if
(
!
S_ISDIR
(
st
.
st_mode
))
{
ERROR
(
"
\"
%s
\"
is not a directory
\n
"
,
options
.
playlistDirArg
);
return
-
1
;
return
EXIT_FAILURE
;
}
if
(
options
.
musicDirArg
[
0
]
==
'/'
)
{
...
...
@@ -321,11 +321,11 @@ int main(int argc, char * argv[]) {
if
(
musicDir
[
strlen
(
musicDir
)
-
1
]
!=
'/'
)
strcat
(
musicDir
,
"/"
);
if
((
stat
(
musicDir
,
&
st
))
<
0
)
{
ERROR
(
"problem stat'ing
\"
%s
\"\n
"
,
options
.
musicDirArg
);
return
-
1
;
return
EXIT_FAILURE
;
}
if
(
!
S_ISDIR
(
st
.
st_mode
))
{
ERROR
(
"
\"
%s
\"
is not a directory
\n
"
,
options
.
musicDirArg
);
return
-
1
;
return
EXIT_FAILURE
;
}
initTables
();
...
...
@@ -344,12 +344,12 @@ int main(int argc, char * argv[]) {
if
(
options
.
createDB
<
0
)
{
ERROR
(
"can't open db file and using
\"
--no-create-db
\"
"
" command line option
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
initMp3Directory
();
if
(
writeDirectoryDB
()
<
0
)
{
ERROR
(
"problem opening db for reading or writing
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
...
...
@@ -365,54 +365,54 @@ int main(int argc, char * argv[]) {
fflush
(
NULL
);
pid
=
fork
();
if
(
pid
>
0
)
_exit
(
0
);
if
(
pid
>
0
)
_exit
(
EXIT_SUCCESS
);
else
if
(
pid
<
0
)
{
ERROR
(
"problems fork'ing for daemon!
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
chdir
(
"/"
)
<
0
)
{
ERROR
(
"problems changing to root directory
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
setsid
()
<
0
)
{
ERROR
(
"problems setsid'ing
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
close
(
STDOUT_FILENO
))
{
fprintf
(
err
,
"problems closing stdout : %s
\n
"
,
strerror
(
errno
));
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
close
(
STDERR_FILENO
))
{
fprintf
(
err
,
"problems closing stderr : %s
\n
"
,
strerror
(
errno
));
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
dup2
(
fileno
(
out
),
STDOUT_FILENO
)
<
0
)
{
fprintf
(
err
,
"problems dup2 stdout : %s
\n
"
,
strerror
(
errno
));
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
dup2
(
fileno
(
err
),
STDERR_FILENO
)
<
0
)
{
fprintf
(
err
,
"problems dup2 stderr : %s
\n
"
,
strerror
(
errno
));
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
myfprintfStdLogMode
(
out
,
err
);
fflush
(
NULL
);
pid
=
fork
();
if
(
pid
>
0
)
_exit
(
0
);
if
(
pid
>
0
)
_exit
(
EXIT_SUCCESS
);
else
if
(
pid
<
0
)
{
ERROR
(
"problems fork'ing for daemon!
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
else
{
...
...
@@ -426,12 +426,12 @@ int main(int argc, char * argv[]) {
if
(
fd
<
0
)
{
ERROR
(
"not able to open /dev/null to redirect stdin: "
"%s
\n
"
,
strerror
(
errno
));
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
dup2
(
fd
,
STDIN_FILENO
)
<
0
)
{
ERROR
(
"problems dup2's stdin for redirection: "
"%s
\n
"
,
strerror
(
errno
));
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
...
...
@@ -461,5 +461,5 @@ int main(int argc, char * argv[]) {
finishPermissions
();
finishCommands
();
return
0
;
return
EXIT_SUCCESS
;
}
src/pcm_utils.c
View file @
785cdb01
...
...
@@ -80,7 +80,7 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format,
default:
ERROR
(
"%i bits not supported by pcm_volumeChange!
\n
"
,
format
->
bits
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
...
...
@@ -120,7 +120,7 @@ void pcm_add(char * buffer1, char * buffer2, size_t bufferSize1,
break
;
default:
ERROR
(
"%i bits not supported by pcm_add!
\n
"
,
format
->
bits
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
...
...
src/permission.c
View file @
785cdb01
...
...
@@ -59,7 +59,7 @@ unsigned int parsePermissions(char * string) {
}
else
{
ERROR
(
"uknown permission
\"
%s
\"\n
"
,
temp
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
temp
=
strtok_r
(
NULL
,
PERMISSION_SEPERATOR
,
&
tok
);
...
...
@@ -99,12 +99,12 @@ void initPermissions() {
ERROR
(
"
\"
%s
\"
not found in password string
\"
%s
\"\n
"
,
PERMISSION_PASSWORD_CHAR
,
nextSet
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
!
(
temp
=
strtok_r
(
nextSet
,
PERMISSION_PASSWORD_CHAR
,
&
cp2
)))
{
ERROR
(
"something weird just happend in permission.c
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
password
=
temp
;
...
...
src/player.c
View file @
785cdb01
...
...
@@ -137,7 +137,7 @@ int playerInit() {
else
my_usleep
(
10000
);
}
exit
(
0
);
exit
(
EXIT_SUCCESS
);
}
else
if
(
player_pid
<
0
)
{
ERROR
(
"player Problems fork()'ing
\n
"
);
...
...
src/playerData.c
View file @
785cdb01
...
...
@@ -45,7 +45,7 @@ void initPlayerData() {
if
(
*
test
!=
'\0'
||
bufferSize
<=
0
)
{
ERROR
(
"buffer size
\"
%s
\"
is not a positive integer
\n
"
,
getConf
()[
CONF_BUFFER_SIZE
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
bufferSize
*=
1024
;
...
...
@@ -53,7 +53,7 @@ void initPlayerData() {
if
(
buffered_chunks
>=
1
<<
15
)
{
ERROR
(
"buffer size
\"
%i
\"
is too big
\n
"
,
bufferSize
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
perc
=
strtod
((
getConf
())[
CONF_BUFFER_BEFORE_PLAY
],
&
test
);
...
...
@@ -61,7 +61,7 @@ void initPlayerData() {
ERROR
(
"buffered before play
\"
%s
\"
is not a positive "
"percentage and less than 100 percent
\n
"
,
(
getConf
())[
CONF_BUFFER_BEFORE_PLAY
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
buffered_before_play
=
(
perc
/
100
)
*
buffered_chunks
;
if
(
buffered_before_play
>
buffered_chunks
)
{
...
...
@@ -77,15 +77,15 @@ void initPlayerData() {
if
((
shmid
=
shmget
(
IPC_PRIVATE
,
allocationSize
,
IPC_CREAT
|
0600
))
<
0
)
{
ERROR
(
"problems shmget'ing
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
((
playerData_pd
=
shmat
(
shmid
,
NULL
,
0
))
<
0
)
{
ERROR
(
"problems shmat'ing
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
shmctl
(
shmid
,
IPC_RMID
,
0
)
<
0
)
{
ERROR
(
"problems shmctl'ing
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
buffer
=
&
(
playerData_pd
->
buffer
);
...
...
src/playlist.c
View file @
785cdb01
...
...
@@ -108,7 +108,7 @@ void initPlaylist() {
if
(
*
test
!=
'\0'
)
{
ERROR
(
"max playlist length
\"
%s
\"
is not an integer
\n
"
,
(
getConf
())[
CONF_MAX_PLAYLIST_LENGTH
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
strcmp
(
"yes"
,(
getConf
())[
CONF_SAVE_ABSOLUTE_PATHS_IN_PLAYLISTS
])
...
...
@@ -123,7 +123,7 @@ void initPlaylist() {
ERROR
(
"save_absolute_paths_in_playlist
\"
%s
\"
is not yes or "
"no
\n
"
,
(
getConf
())[
CONF_SAVE_ABSOLUTE_PATHS_IN_PLAYLISTS
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
playlist
.
songs
=
malloc
(
sizeof
(
Song
*
)
*
playlist_max_length
);
...
...
@@ -228,14 +228,14 @@ void loadPlaylistFromStateFile(FILE * fp, char * buffer, int state, int current,
if
(
!
myFgets
(
buffer
,
PLAYLIST_BUFFER_SIZE
,
fp
))
{
ERROR
(
"error parsing state file
\"
%s
\"\n
"
,
playlist_stateFile
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
while
(
strcmp
(
buffer
,
PLAYLIST_STATE_FILE_PLAYLIST_END
))
{
song
=
atoi
(
strtok
(
buffer
,
":"
));
if
(
!
(
temp
=
strtok
(
NULL
,
""
)))
{
ERROR
(
"error parsing state file
\"
%s
\"\n
"
,
playlist_stateFile
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
addToPlaylist
(
stderr
,
temp
)
==
0
&&
current
==
song
)
{
if
(
state
!=
PLAYER_STATE_STOP
)
{
...
...
@@ -252,7 +252,7 @@ void loadPlaylistFromStateFile(FILE * fp, char * buffer, int state, int current,
if
(
!
myFgets
(
buffer
,
PLAYLIST_BUFFER_SIZE
,
fp
))
{
ERROR
(
"error parsing state file
\"
%s
\"\n
"
,
playlist_stateFile
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
}
...
...
@@ -270,14 +270,14 @@ void readPlaylistState() {
if
(
!
S_ISREG
(
st
.
st_mode
))
{
ERROR
(
"state file
\"
%s
\"
is not a regular "
"file
\n
"
,
playlist_stateFile
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
fp
=
fopen
(
playlist_stateFile
,
"r"
);
if
(
!
fp
)
{
ERROR
(
"problems opening state file
\"
%s
\"
for "
"reading
\n
"
,
playlist_stateFile
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
while
(
myFgets
(
buffer
,
PLAYLIST_BUFFER_SIZE
,
fp
))
{
...
...
@@ -329,7 +329,7 @@ void readPlaylistState() {
ERROR
(
"error parsing state "
"file
\"
%s
\"\n
"
,
playlist_stateFile
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
current
=
atoi
(
&
(
buffer
[
strlen
(
PLAYLIST_STATE_FILE_CURRENT
)]));
...
...
src/sig_handlers.c
View file @
785cdb01
...
...
@@ -28,7 +28,7 @@ void termSigHandler(int signal) {
if
(
signal
==
SIGTERM
)
{
savePlaylistState
();
playerKill
();
exit
(
0
);
exit
(
EXIT_SUCCESS
);
}
}
...
...
src/song.c
View file @
785cdb01
...
...
@@ -179,7 +179,7 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
else
if
(
0
==
strncmp
(
SONG_FILE
,
buffer
,
strlen
(
SONG_FILE
)))
{
if
(
!
song
||
song
->
utf8file
)
{
ERROR
(
"Problems reading song info
\n
"
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
song
->
utf8file
=
strdup
(
&
(
buffer
[
strlen
(
SONG_FILE
)]));
}
...
...
@@ -208,7 +208,7 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
}
else
{
ERROR
(
"songinfo: unknown line in db: %s
\n
"
,
buffer
);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
}
...
...
src/volume.c
View file @
785cdb01
...
...
@@ -358,7 +358,7 @@ void initVolume() {
}
else
{
ERROR
(
"unknown mixer type: %s
\n
"
,(
getConf
())[
CONF_MIXER_TYPE
]);
exit
(
-
1
);
exit
(
EXIT_FAILURE
);
}
if
(
strlen
((
getConf
())[
CONF_MIXER_DEVICE
]))
{
volume_mixerDevice
=
(
getConf
())[
CONF_MIXER_DEVICE
];
...
...
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