Skip to content

Commit

Permalink
Fix warning about snprintf() being deprecated on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
qris committed Nov 11, 2016
1 parent 64be957 commit eeb2a12
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/server/Daemon.cpp
Expand Up @@ -568,11 +568,11 @@ int Daemon::Main(const std::string &rConfigFileName)
#endif // !WIN32

// Write PID to file
char pid[32];
std::ostringstream pid_buf;
pid_buf << getpid();
std::string pid_str = pid_buf.str();

int pidsize = snprintf(pid, sizeof(pid), "%d", (int)getpid());

if(::write(pidFile, pid, pidsize) != pidsize)
if(::write(pidFile, pid_str.c_str(), pid_str.size()) != pid_str.size())
{
BOX_LOG_SYS_FATAL("Failed to write PID file: " <<
pidFileName);
Expand Down

0 comments on commit eeb2a12

Please sign in to comment.