Merge pull request #2630 from lordofhyphens/fix-admesh-warning
Fix a warning about unused return value when using freopen in admesh.
This commit is contained in:
commit
6413d5dcba
1 changed files with 15 additions and 1 deletions
|
@ -135,7 +135,21 @@ stl_count_facets(stl_file *stl, char *file) {
|
|||
/* Otherwise, if the .STL file is ASCII, then do the following */
|
||||
else {
|
||||
/* Reopen the file in text mode (for getting correct newlines on Windows) */
|
||||
freopen(file, "r", stl->fp);
|
||||
// fix to silence a warning about unused return value.
|
||||
// obviously if it fails we have problems....
|
||||
stl->fp = freopen(file, "r", stl->fp);
|
||||
|
||||
// do another null check to be safe
|
||||
if(stl->fp == NULL) {
|
||||
error_msg = (char*)
|
||||
malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */
|
||||
sprintf(error_msg, "stl_initialize: Couldn't open %s for reading",
|
||||
file);
|
||||
perror(error_msg);
|
||||
free(error_msg);
|
||||
stl->error = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find the number of facets */
|
||||
j = 0;
|
||||
|
|
Loading…
Reference in a new issue