make sure parameter is not negative

- fixes coverity issue 1198843 Argument cannot be negative
This commit is contained in:
Dennis Luxen 2014-05-08 08:56:51 +02:00
parent bed5c8002f
commit 2850a074ea

View File

@ -116,9 +116,13 @@ int main(int argc, char *argv[])
#ifdef __linux__ #ifdef __linux__
int f = int f =
open(test_path.string().c_str(), O_CREAT | O_TRUNC | O_WRONLY | O_SYNC, S_IRWXU); open(test_path.string().c_str(), O_CREAT | O_TRUNC | O_WRONLY | O_SYNC, S_IRWXU);
if (-1 == f)
{
throw OSRMException("Could not open random data file");
}
time1 = std::chrono::steady_clock::now(); time1 = std::chrono::steady_clock::now();
int ret = write(f, random_array, number_of_elements * sizeof(unsigned)); int ret = write(f, random_array, number_of_elements * sizeof(unsigned));
if (-1 == ret) if (0 > ret)
{ {
throw OSRMException("could not write random data file"); throw OSRMException("could not write random data file");
} }