Skip to content
Snippets Groups Projects
Commit d3dd24ad authored by Tim Wickberg's avatar Tim Wickberg
Browse files

Prevent feeding strerror() a negative value.

Many open Coverity issues point back to this. The results
of passing a negative value to strerror() are undefined,
return a static string instead.
parent 1b010388
No related branches found
No related tags found
No related merge requests found
......@@ -492,7 +492,12 @@ static char *_lookup_slurm_api_errtab(int errnum)
char *slurm_strerror(int errnum)
{
char *res = _lookup_slurm_api_errtab(errnum);
return (res ? res : strerror(errnum));
if (res)
return res;
else if (errnum > 0)
return strerror(errnum);
else
return "Unknown negative error number";
}
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment