gsdx: check the return value of mkdir function

Reported by coverity
This commit is contained in:
Gregory Hainaut 2015-09-26 13:41:44 +02:00
parent 457362ba84
commit 00e37224ed
5 changed files with 19 additions and 10 deletions

View File

@ -22,9 +22,7 @@
#include "stdafx.h"
#include "GSCapture.h"
#include "GSPng.h"
#ifdef __linux__
#include <sys/stat.h> // mkdir
#endif
#include "GSUtil.h"
#ifdef _WINDOWS
@ -482,7 +480,7 @@ bool GSCapture::BeginCapture(float fps, GSVector2i recomendedResolution, float a
#elif __linux__
// Note I think it doesn't support multiple depth creation
mkdir(m_out_dir.c_str(), 0777);
GSmkdir(m_out_dir.c_str());
// Really cheap recording
m_frame = 0;

View File

@ -23,10 +23,6 @@
#include "GSState.h"
#include "GSdx.h"
#ifdef __linux__
#include <sys/stat.h> // mkdir
#endif
//#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering
static int s_crc_hack_level = 3;
@ -59,8 +55,8 @@ GSState::GSState()
s_savel = theApp.GetConfig("savel", 5000);
#ifdef __linux__
if (s_dump) {
mkdir("/tmp/GS_HW_dump", 0777);
mkdir("/tmp/GS_SW_dump", 0777);
GSmkdir("/tmp/GS_HW_dump");
GSmkdir("/tmp/GS_SW_dump");
}
#endif

View File

@ -415,4 +415,12 @@ D3D_FEATURE_LEVEL GSUtil::CheckDirect3D11Level(IDXGIAdapter *adapter, D3D_DRIVER
return SUCCEEDED(hr) ? level : (D3D_FEATURE_LEVEL)0;
}
#else
void GSmkdir(const char* dir)
{
if (mkdir(dir, 0777))
fprintf(stderr, "Failed to create directory: %s\n", dir);
}
#endif

View File

@ -65,3 +65,6 @@ public:
#endif
};
#ifdef __linux__
void GSmkdir(const char* dir);
#endif

View File

@ -116,6 +116,10 @@ using namespace std;
using namespace stdext;
#endif
#ifdef __linux__
#include <sys/stat.h> // mkdir
#endif
#ifdef _WINDOWS
// Note use GL/glcorearb.h on the future