Ticket #6237: mythtv-enable_mythfrontend_logging_early.patch
| File mythtv-enable_mythfrontend_logging_early.patch, 3.4 KB (added by , 17 years ago) |
|---|
-
programs/mythfrontend/main.cpp
old new 1099 1099 return FRONTEND_EXIT_INVALID_CMDLINE; 1100 1100 } 1101 1101 } 1102 else if (!strcmp(a.argv()[argpos],"-l") || 1103 !strcmp(a.argv()[argpos],"--logfile")) 1104 { 1105 if (a.argc()-1 > argpos) 1106 { 1107 logfile = a.argv()[argpos+1]; 1108 if (logfile.startsWith("-")) 1109 { 1110 cerr << "Invalid or missing argument" 1111 " to -l/--logfile option\n"; 1112 return FRONTEND_EXIT_INVALID_CMDLINE; 1113 } 1114 else 1115 { 1116 ++argpos; 1117 } 1118 } 1119 else 1120 { 1121 cerr << "Missing argument to -l/--logfile option\n"; 1122 return FRONTEND_EXIT_INVALID_CMDLINE; 1123 } 1124 } 1102 1125 else if (cmdline.Parse(a.argc(), a.argv(), argpos, cmdline_err)) 1103 1126 { 1104 1127 if (cmdline_err) … … 1109 1132 } 1110 1133 QMap<QString,QString> settingsOverride = cmdline.GetSettingsOverride(); 1111 1134 1135 if (logfile.size()) 1136 { 1137 if (log_rotate(1) < 0) 1138 cerr << "cannot open logfile; using stdout/stderr" << endl; 1139 else 1140 { 1141 VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org") 1142 .arg(binname) 1143 .arg(myth_source_path) 1144 .arg(myth_source_version)); 1145 1146 signal(SIGHUP, &log_rotate_handler); 1147 } 1148 } 1149 1150 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) 1151 cerr << "Unable to ignore SIGPIPE\n"; 1152 1112 1153 if (!cmdline.GetDisplay().isEmpty()) 1113 1154 { 1114 1155 MythUIHelper::SetX11Display(cmdline.GetDisplay()); … … 1130 1171 if (!strcmp(a.argv()[argpos],"-l") || 1131 1172 !strcmp(a.argv()[argpos],"--logfile")) 1132 1173 { 1133 if (a.argc()-1 > argpos) 1134 { 1135 logfile = a.argv()[argpos+1]; 1136 if (logfile.startsWith("-")) 1137 { 1138 cerr << "Invalid or missing argument" 1139 " to -l/--logfile option\n"; 1140 return FRONTEND_EXIT_INVALID_CMDLINE; 1141 } 1142 else 1143 { 1144 ++argpos; 1145 } 1146 } 1147 else 1148 { 1149 cerr << "Missing argument to -l/--logfile option\n"; 1150 return FRONTEND_EXIT_INVALID_CMDLINE; 1151 } 1174 // Arg processing for logfile already done (before MythContext) 1175 ++argpos; 1152 1176 } else if (!strcmp(a.argv()[argpos],"-v") || 1153 1177 !strcmp(a.argv()[argpos],"--verbose")) 1154 1178 { … … 1216 1240 return FRONTEND_EXIT_OK; 1217 1241 } 1218 1242 1219 if (logfile.size())1220 {1221 if (log_rotate(1) < 0)1222 cerr << "cannot open logfile; using stdout/stderr" << endl;1223 else1224 signal(SIGHUP, &log_rotate_handler);1225 }1226 1227 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)1228 cerr << "Unable to ignore SIGPIPE\n";1229 1230 1243 QString fileprefix = GetConfDir(); 1231 1244 1232 1245 QDir dir(fileprefix);
