lib/utils_cmd.c - Free file descriptor

Coverity 66502 - File descriptor fd in cmd_file_read is never closed, and thus file is left open after usage throughout runtime. - SR
This commit is contained in:
Spenser Reinhardt 2014-06-23 13:54:39 -05:00 committed by Jan Wagner
parent aa16beb971
commit 9123f6146c

View file

@ -390,6 +390,9 @@ cmd_file_read ( char *filename, output *out, int flags)
if(out)
out->lines = _cmd_fetch_output (fd, out, flags);
if (close(fd) == -1)
die( STATE_UNKNOWN, _("Error closing %s: %s"), filename, strerror(errno) );
return 0;
}