diff --git a/UMTS/UMTSRadioModem.cpp b/UMTS/UMTSRadioModem.cpp index 7194f49..f660cbb 100644 --- a/UMTS/UMTSRadioModem.cpp +++ b/UMTS/UMTSRadioModem.cpp @@ -1211,7 +1211,7 @@ void RadioModem::transmitSlot(UMTS::Time nowTime, bool &underrun) // write to the socket mDataSocket.write(buffer,bufferSize); - delete []buffer; + free(buffer); mLastTransmitTime = nowTime; //LOG(INFO) << LOGVAR(mLastTransmitTime) < #include #include +#include #ifdef HAVE_LIBREADLINE // [ //# include @@ -260,11 +261,15 @@ int main(int argc, char *argv[]) struct sockaddr_un cmdSockName; cmdSockName.sun_family = AF_UNIX; - const char* sockpath = gConfig.getStr("CLI.SocketPath").c_str(); - char rmcmd[strlen(sockpath)+5]; - sprintf(rmcmd,"rm -f %s",sockpath); - if (system(rmcmd)) {} // The 'if' shuts up gcc warnings. - strcpy(cmdSockName.sun_path,sockpath); + const string sockpath = gConfig.getStr("CLI.SocketPath"); + int rc = unlink(sockpath.c_str()); + if (rc == -1) { + // If it does not exist just move on, otherwise say something + if (errno != ENOENT) { + LOG(ALERT) << "Cannot delete CLI sock file, error: " << strerror(errno); + } + } + strcpy(cmdSockName.sun_path,sockpath.c_str()); LOG(INFO) "binding CLI datagram socket at " << sockpath; if (bind(sock, (struct sockaddr *) &cmdSockName, sizeof(struct sockaddr_un))) { perror("binding name to cmd datagram socket");