strdup() may fail
parent
46539695c0
commit
cf9205d621
|
@ -49,9 +49,11 @@ namespace SignedPackage {
|
|||
{
|
||||
std::filesystem::path path = std::filesystem::temp_directory_path() / "spXXXXXXXXXXXX";
|
||||
std::unique_ptr< char[] > buffer { ::strdup(path.c_str()) };
|
||||
if (!buffer.get())
|
||||
throw std::bad_alloc();
|
||||
|
||||
char *p = mkdtemp(buffer.get());
|
||||
if (p == nullptr) {
|
||||
if (!p) {
|
||||
throw std::filesystem::filesystem_error(::strerror(errno),
|
||||
std::error_code(errno, std::system_category()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue