mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
libtt: resolve coverity issues related to double close()
This commit is contained in:
parent
680f79aac3
commit
91bb9a037a
1 changed files with 22 additions and 7 deletions
|
@ -75,7 +75,7 @@ isrepair(isfname, verbose)
|
||||||
{
|
{
|
||||||
extern char *rp_readrecord_v(), *rp_readrecord_f();
|
extern char *rp_readrecord_v(), *rp_readrecord_f();
|
||||||
char cntlpg[ISCNTLSIZE];
|
char cntlpg[ISCNTLSIZE];
|
||||||
int datfd, indfd, varfd;
|
int datfd = -1, indfd = -1, varfd = -1;
|
||||||
int minreclen, maxreclen;
|
int minreclen, maxreclen;
|
||||||
int nrecords_fromcntl;
|
int nrecords_fromcntl;
|
||||||
int varflag;
|
int varflag;
|
||||||
|
@ -225,9 +225,18 @@ isrepair(isfname, verbose)
|
||||||
/*
|
/*
|
||||||
* Close all file descriptors.
|
* Close all file descriptors.
|
||||||
*/
|
*/
|
||||||
(void)close(datfd);
|
if(datfd != -1) {
|
||||||
(void)close(indfd);
|
close(datfd);
|
||||||
(void)close(varfd);
|
datfd = -1;
|
||||||
|
}
|
||||||
|
if(indfd != -1) {
|
||||||
|
close(indfd);
|
||||||
|
indfd = -1;
|
||||||
|
}
|
||||||
|
if(varfd != -1) {
|
||||||
|
close(varfd);
|
||||||
|
varfd = -1;
|
||||||
|
}
|
||||||
(void)isclose(isfd);
|
(void)isclose(isfd);
|
||||||
|
|
||||||
(void) sigfillset(&allsignals);
|
(void) sigfillset(&allsignals);
|
||||||
|
@ -304,9 +313,15 @@ isrepair(isfname, verbose)
|
||||||
|
|
||||||
ERROR:
|
ERROR:
|
||||||
(void)print("\007Didn't repair ISAM file '%s'\n", isfname);
|
(void)print("\007Didn't repair ISAM file '%s'\n", isfname);
|
||||||
(void)close(datfd);
|
if(datfd != -1) {
|
||||||
(void)close(indfd);
|
close(datfd);
|
||||||
(void)close(varfd);
|
}
|
||||||
|
if(indfd != -1) {
|
||||||
|
close(indfd);
|
||||||
|
}
|
||||||
|
if(varfd != -1) {
|
||||||
|
close(varfd);
|
||||||
|
}
|
||||||
(void)isclose(isfd);
|
(void)isclose(isfd);
|
||||||
if (namebuf != nameBuf) free(namebuf);
|
if (namebuf != nameBuf) free(namebuf);
|
||||||
if (buffer != Buffer) free(buffer);
|
if (buffer != Buffer) free(buffer);
|
||||||
|
|
Loading…
Reference in a new issue