mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-22 06:24:24 -04:00
use return value of stat instead of just checking errno. This has the added benefit of catching other errors when stating
This commit is contained in:
1 parent
fcc1f9705f
commit
95087beeb9
1 file changed
+10
-7
+10
-7
@@ -119,13 +119,16 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string
|
||||
|
||||
struct stat statbuf;
|
||||
errno = 0;
|
||||
stat( path, &statbuf );
|
||||
if ( errno == ENOENT || errno == ENOTDIR )
|
||||
{
|
||||
if ( mkdir( path, 0755 ) )
|
||||
{
|
||||
Fatal( "Can't mkdir %s: %s", path, strerror(errno));
|
||||
}
|
||||
if ( stat( path, &statbuf ) ) {
|
||||
if ( errno == ENOENT || errno == ENOTDIR )
|
||||
{
|
||||
if ( mkdir( path, 0755 ) )
|
||||
{
|
||||
Fatal( "Can't mkdir %s: %s", path, strerror(errno));
|
||||
}
|
||||
} else {
|
||||
Warning( "Error stat'ing %s, may be fatal. error is %s", path, strerror(errno));
|
||||
}
|
||||
}
|
||||
if ( i == 2 )
|
||||
strncpy( date_path, path, sizeof(date_path) );
|
||||
|
||||
Reference in new issue
Block a user