Resolve deprecation warnings by replacing use of sprintf with FmtBuffer

This commit is contained in:
Dave Hocker
2023-02-05 11:40:10 -06:00
committed by Max Kellermann
parent e0df0b6d74
commit f248fe2dec
2 changed files with 8 additions and 11 deletions

View File

@@ -24,6 +24,7 @@
#include "fs/FileSystem.hxx"
#include "fs/AllocatedPath.hxx"
#include "lib/fmt/SystemError.hxx"
#include "lib/fmt/ToBuffer.hxx"
#include <cassert>
@@ -71,10 +72,9 @@ public:
if (fd < 0)
return;
char buffer[64];
sprintf(buffer, "%lu\n", (unsigned long)pid);
const auto s = FmtBuffer<64>("{}\n", pid);
write(fd, buffer, strlen(buffer));
write(fd, s.c_str(), strlen(s.c_str()));
close(fd);
}