1 | Check the return value of function calls. |
---|
2 | |
---|
3 | From: Erik Hovland <erik@hovland.org> |
---|
4 | |
---|
5 | |
---|
6 | --- |
---|
7 | |
---|
8 | mythtv/programs/mythlcdserver/lcdprocclient.cpp | 4 +++- |
---|
9 | mythtv/programs/mythlcdserver/main.cpp | 16 ++++++++++------ |
---|
10 | 2 files changed, 13 insertions(+), 7 deletions(-) |
---|
11 | |
---|
12 | |
---|
13 | diff --git a/mythtv/programs/mythlcdserver/lcdprocclient.cpp b/mythtv/programs/mythlcdserver/lcdprocclient.cpp |
---|
14 | index 7a0cbe0..0f6a5c5 100644 |
---|
15 | --- a/mythtv/programs/mythlcdserver/lcdprocclient.cpp |
---|
16 | +++ b/mythtv/programs/mythlcdserver/lcdprocclient.cpp |
---|
17 | @@ -293,7 +293,9 @@ void LCDProcClient::checkConnections() |
---|
18 | { |
---|
19 | if (debug_level > 0) |
---|
20 | VERBOSE(VB_GENERAL, "LCDProcClient: connecting to master server"); |
---|
21 | - gContext->ConnectToMasterServer(false); |
---|
22 | + |
---|
23 | + if (!gContext->ConnectToMasterServer(false)) |
---|
24 | + VERBOSE(VB_IMPORTANT, "LCDProcClient: connecting to master server failed"); |
---|
25 | } |
---|
26 | |
---|
27 | //check connection to LCDProc server |
---|
28 | diff --git a/mythtv/programs/mythlcdserver/main.cpp b/mythtv/programs/mythlcdserver/main.cpp |
---|
29 | index 7e6addb..326052d 100644 |
---|
30 | --- a/mythtv/programs/mythlcdserver/main.cpp |
---|
31 | +++ b/mythtv/programs/mythlcdserver/main.cpp |
---|
32 | @@ -215,12 +215,16 @@ int main(int argc, char **argv) |
---|
33 | if (logfd != -1) |
---|
34 | { |
---|
35 | // Send stdout and stderr to the logfile |
---|
36 | - dup2(logfd, 1); |
---|
37 | - dup2(logfd, 2); |
---|
38 | - |
---|
39 | - // Close the unduplicated logfd |
---|
40 | - if (logfd != 1 && logfd != 2) |
---|
41 | - close(logfd); |
---|
42 | + if (dup2(logfd, 1) == -1) |
---|
43 | + { |
---|
44 | + perror("dup2(stdout)"); |
---|
45 | + return FRONTEND_EXIT_OPENING_LOGFILE_ERROR; |
---|
46 | + } |
---|
47 | + if (dup2(logfd, 2) == -1); |
---|
48 | + { |
---|
49 | + perror("dup2(stderr)"); |
---|
50 | + return FRONTEND_EXIT_OPENING_LOGFILE_ERROR; |
---|
51 | + } |
---|
52 | } |
---|
53 | |
---|
54 | if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) |
---|