diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-12-22 23:09:31 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-12-22 23:09:31 +0000 |
commit | 6622bfe4eb59a2f38f7012349525ec64f0368118 (patch) | |
tree | b116a1ec4a429ad3ecf0d8817488557f196782b1 /lib/server/Daemon.cpp | |
parent | e88418c0145ddeba97116e49074dd8e2e9edea7a (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.cpp | 7 |
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 |