Changeset 2597
- Timestamp:
- 24/01/2010 13:46:23 (2 years ago)
- Location:
- box/trunk
- Files:
-
- 3 edited
-
bin/bbackupd/BackupDaemon.cpp (modified) (6 diffs)
-
lib/server/LocalProcessStream.cpp (modified) (4 diffs)
-
lib/server/LocalProcessStream.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/bin/bbackupd/BackupDaemon.cpp
r2588 r2597 1018 1018 int waitInSeconds = (60*5); 1019 1019 1020 std::string script(conf.GetKeyValue("SyncAllowScript") + 1021 " \"" + GetConfigFileName() + "\""); 1022 1020 1023 // Run it? 1021 1024 pid_t pid = 0; 1022 1025 try 1023 1026 { 1024 std::string script("\"" + conf.GetKeyValue("SyncAllowScript") + 1025 "\" \"" + GetConfigFileName() + "\""); 1026 1027 std::auto_ptr<IOStream> pscript(LocalProcessStream( 1028 script.c_str(), pid)); 1027 std::auto_ptr<IOStream> pscript(LocalProcessStream(script, 1028 pid)); 1029 1029 1030 1030 // Read in the result … … 1049 1049 { 1050 1050 BOX_ERROR("Invalid output from " 1051 "SyncAllowScript " <<1052 script << ": '" << line << "'");1051 "SyncAllowScript: '" << 1052 line << "' (" << script << ")"); 1053 1053 throw; 1054 1054 } 1055 1055 1056 1056 BOX_NOTICE("Delaying sync by " << waitInSeconds 1057 << " seconds (SyncAllowScript " 1058 << conf.GetKeyValue("SyncAllowScript") 1059 << ")"); 1057 << " seconds due to SyncAllowScript " 1058 << "(" << script << ")"); 1060 1059 } 1061 1060 } … … 1065 1064 { 1066 1065 BOX_ERROR("Internal error running SyncAllowScript: " 1067 << e.what() );1066 << e.what() << " (" << script << ")"); 1068 1067 } 1069 1068 catch(...) … … 1071 1070 // Ignore any exceptions 1072 1071 // Log that something bad happened 1073 BOX_ERROR(" Error running SyncAllowScript '"1074 << conf.GetKeyValue("SyncAllowScript") << "'");1072 BOX_ERROR("Unknown error running SyncAllowScript (" << 1073 script << ")"); 1075 1074 } 1076 1075 … … 2189 2188 { 2190 2189 BOX_INFO("Not notifying administrator about event " 2191 << sEventNames[Event] << " --set NotifyScript "2190 << sEventNames[Event] << ", set NotifyScript " 2192 2191 "to do this in future"); 2193 2192 } … … 2196 2195 2197 2196 // Script to run 2198 std::string script( "\"" + conf.GetKeyValue("NotifyScript") + "\" " +2197 std::string script(conf.GetKeyValue("NotifyScript") + " " + 2199 2198 sEventNames[Event] + " \"" + GetConfigFileName() + "\""); 2200 2199 2201 2200 // Log what we're about to do 2202 2201 BOX_INFO("About to notify administrator about event " 2203 << sEventNames[Event] << ", running script " << script);2202 << sEventNames[Event] << ", running script '" << script << "'"); 2204 2203 2205 2204 // Then do it -
box/trunk/lib/server/LocalProcessStream.cpp
r1822 r2597 44 44 // 45 45 // -------------------------------------------------------------------------- 46 std::auto_ptr<IOStream> LocalProcessStream(const char *CommandLine, pid_t &rPidOut) 46 std::auto_ptr<IOStream> LocalProcessStream(const std::string& rCommandLine, 47 pid_t &rPidOut) 47 48 { 48 49 #ifndef WIN32 … … 50 51 // Split up command 51 52 std::vector<std::string> command; 52 SplitString( std::string(CommandLine), ' ', command);53 SplitString(rCommandLine, ' ', command); 53 54 54 55 // Build arguments … … 138 139 startupInfo.dwFlags |= STARTF_USESTDHANDLES; 139 140 140 CHAR* commandLineCopy = (CHAR*)malloc( strlen(CommandLine) + 1);141 strcpy(commandLineCopy, CommandLine);141 CHAR* commandLineCopy = (CHAR*)malloc(rCommandLine.size() + 1); 142 strcpy(commandLineCopy, rCommandLine.c_str()); 142 143 143 144 BOOL result = CreateProcess(NULL, … … 156 157 if(!result) 157 158 { 158 BOX_ERROR("Failed to CreateProcess: '" << CommandLine <<159 BOX_ERROR("Failed to CreateProcess: '" << rCommandLine << 159 160 "': " << GetErrorMessage(GetLastError())); 160 161 CloseHandle(writeInChild); -
box/trunk/lib/server/LocalProcessStream.h
r217 r2597 14 14 #include "IOStream.h" 15 15 16 std::auto_ptr<IOStream> LocalProcessStream(const char *CommandLine, pid_t &rPidOut); 16 std::auto_ptr<IOStream> LocalProcessStream(const std::string& rCommandLine, 17 pid_t &rPidOut); 17 18 18 19 #endif // LOCALPROCESSSTREAM__H
Note: See TracChangeset
for help on using the changeset viewer.
