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