Package: gerbera / 1.1.0+dfsg-3

0012_reload-log-on-hup.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Description: Re-open log file on SIGHUP
 When SIGHUP is received, re-open the log file so that logrotate works
 properly.
Author: James Cowgill <jcowgill@debian.org>
Forwarded: no
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/main.cc
+++ b/src/main.cc
@@ -114,6 +114,7 @@ int main(int argc, char** argv, char** e
     String magic;
     bool debug_logging = false;
     bool print_version = false;
+    char* log_file = nullptr;
 
     Ref<Array<StringBase> > addFile(new Array<StringBase>());
 
@@ -174,6 +175,7 @@ int main(int argc, char** argv, char** e
 
         case 'l':
             log_debug("Log file: %s\n", optarg);
+            log_file = optarg;
             log_open(optarg);
             break;
 
@@ -415,6 +417,12 @@ For more information visit " DESC_MANUFA
                     exit(EXIT_FAILURE);
                 }
 
+                // Re-open log file
+                if (log_file != nullptr) {
+                    log_close();
+                    log_open(log_file);
+                }
+
                 ///  \todo fix this for SIGHUP
                 server = Server::getInstance();
                 server->upnp_init();