--- smsdaemon/util.cpp 2008/06/16 06:12:45 84 +++ smsdaemon/util.cpp 2008/06/16 07:39:56 86 @@ -189,11 +189,16 @@ ostringstream command; command << "wget -O " << tempfile << " --tries=1 --timeout=15 -o /dev/null \"" << url << "\""; - int res = system( command.str().c_str() ); + int res = my_system( command.str().c_str() ); + + if (res<0) + { + throw( std::runtime_error("Error retrieving document")); + } if (res>0) { - throw std::runtime_error("Command time out"); + throw std::runtime_error("Command time out or document not found"); } ifstream in( tempfile.c_str() ); @@ -284,6 +289,14 @@ ((now.tv_usec-then.tv_usec)/1000); } + int my_system(const char* cmd) + { + FILE* p; + if ((p = popen(cmd,"w")) == NULL) + return (-1); + return (pclose(p)); + } + }