mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
show error message for mkdtemp
This commit is contained in:
parent
e75f1a3014
commit
c0b745f6c5
@ -11,6 +11,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
@ -322,10 +323,16 @@ int main(int argc, char **argv)
|
|||||||
//prepare the directories
|
//prepare the directories
|
||||||
{
|
{
|
||||||
char buf[] = "/tmp/pdf2htmlEX-XXXXXX";
|
char buf[] = "/tmp/pdf2htmlEX-XXXXXX";
|
||||||
|
errno = 0;
|
||||||
auto p = mkdtemp(buf);
|
auto p = mkdtemp(buf);
|
||||||
if(p == nullptr)
|
if(p == nullptr)
|
||||||
{
|
{
|
||||||
cerr << "Cannot create temp directory" << endl;
|
const char * errmsg = strerror(errno);
|
||||||
|
if(!errmsg)
|
||||||
|
{
|
||||||
|
errmsg = "unknown error";
|
||||||
|
}
|
||||||
|
cerr << "Cannot create temp directory: " << errmsg << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
param.tmp_dir = buf;
|
param.tmp_dir = buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user