summaryrefslogtreecommitdiff
path: root/lib/server/Daemon.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-12-22 23:09:31 +0000
committerChris Wilson <chris+github@qwirx.com>2014-12-22 23:09:31 +0000
commit6622bfe4eb59a2f38f7012349525ec64f0368118 (patch)
treeb116a1ec4a429ad3ecf0d8817488557f196782b1 /lib/server/Daemon.cpp
parente88418c0145ddeba97116e49074dd8e2e9edea7a (diff)
Replace sprintf() with snprintf(), fixes compile warnings on OpenBSD.
And compile errors on recent MinGW.
Diffstat (limited to 'lib/server/Daemon.cpp')
-rw-r--r--lib/server/Daemon.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp
index 521787f8..4715befa 100644
--- a/lib/server/Daemon.cpp
+++ b/lib/server/Daemon.cpp
@@ -567,7 +567,7 @@ int Daemon::Main(const std::string &rConfigFileName)
// Write PID to file
char pid[32];
- int pidsize = sprintf(pid, "%d", (int)getpid());
+ int pidsize = snprintf(pid, sizeof(pid), "%d", (int)getpid());
if(::write(pidFile, pid, pidsize) != pidsize)
{
@@ -579,9 +579,8 @@ int Daemon::Main(const std::string &rConfigFileName)
// Set up memory leak reporting
#ifdef BOX_MEMORY_LEAK_TESTING
{
- char filename[256];
- sprintf(filename, "%s.memleaks", DaemonName());
- memleakfinder_setup_exit_report(filename, DaemonName());
+ memleakfinder_setup_exit_report(std::string(DaemonName()) +
+ ".memleaks", DaemonName());
}
#endif // BOX_MEMORY_LEAK_TESTING