1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-01 07:59:00 +00:00

show error message for mkdtemp

This commit is contained in:
Lu Wang 2013-10-17 11:52:55 +08:00
parent e75f1a3014
commit c0b745f6c5

View File

@ -11,6 +11,7 @@
#include <limits>
#include <iostream>
#include <memory>
#include <errno.h>
#include <getopt.h>
@ -322,10 +323,16 @@ int main(int argc, char **argv)
//prepare the directories
{
char buf[] = "/tmp/pdf2htmlEX-XXXXXX";
errno = 0;
auto p = mkdtemp(buf);
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);
}
param.tmp_dir = buf;